![](https://img-blog.csdnimg.cn/20201014180756922.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
算法
magic-ice
学的越多越感觉到自己的迷茫
展开
-
LeetCode 1. Two Sum
LeetCode 1. Two SumProblemGiven an array of integers, return indices of the two numbers such that they add up to a specific target.You may assume that each input would have exactly one solution, an...原创 2018-11-06 23:50:04 · 82 阅读 · 0 评论 -
LeetCode 12. Integer to Roman
LeetCode 12. Integer to RomanRoman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C ...原创 2018-11-28 20:44:57 · 93 阅读 · 0 评论 -
LeetCode 11. Container With Most Water
原题链接 11. Container With Most Water,Given n non-negative integers a1, a2, …, an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpoints of line i...原创 2018-11-20 18:53:41 · 94 阅读 · 0 评论 -
LeetCode 9. Palindrome Number
Determine whether an integer is a palindrome. An integer is a palindrome when it reads the same backward as forward.Example 1:Input: 121Output: trueExample 2:Input: -121Output: falseExplanation...原创 2018-11-20 18:48:07 · 83 阅读 · 0 评论 -
LeetCode 8. String to Integer (atoi)
LeetCode 8.String to Integer (atoi)Implement atoi which converts a string to an integer.The function first discards as many whitespace characters as necessary until the first non-whitespace charact...原创 2018-11-14 20:46:31 · 76 阅读 · 0 评论 -
LeetCode 6. ZigZag Conversion
/*The string “PAYPALISHIRING” is written in a zigzag pattern on a given number of rows like this:(you may want to display this pattern in a fixed font for better legibility)P A H NA P L S I ...原创 2018-11-12 17:40:16 · 91 阅读 · 0 评论 -
2018年蓝桥杯B组c/c++ 第七题详解
标题:螺旋折线如图p1.png所示的螺旋折线经过平面上所有整点恰好一次。对于整点(X, Y),我们定义它到原点的距离dis(X, Y)是从原点到(X, Y)的螺旋折线段的长度。例如dis(0, 1)=3, dis(-2, -1)=9给出整点坐标(X, Y),你能计算出dis(X, Y)吗?【输入格式】X和Y对于40%的数据,-1000 <= X, Y <= 1000对于...原创 2018-11-08 12:14:15 · 222 阅读 · 0 评论 -
LeetCode 5. Longest Palindromic Substring
/*Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000.Example 1:Input: “babad”Output: “bab”Note: “aba” is also a valid answer.Examp...原创 2018-11-11 17:20:27 · 78 阅读 · 0 评论 -
LeetCode 3. Longest Substring Without Repeating Characters
/*Given a string, find the length of the longest substring without repeating characters.Example 1:Input: “abcabcbb”Output: 3Explanation: The answer is “abc”, with the length of 3.Example 2:Inpu...原创 2018-11-11 13:10:08 · 68 阅读 · 0 评论 -
2018年蓝桥杯B组c/c++ 第九题详解
标题:全球变暖你有一张某海域NxN像素的照片,".“表示海洋、”#"表示陆地,如下所示:........##.....##........##...####....###........其中"上下左右"四个方向上连在一起的一片陆地组成一座岛屿。例如上图就有2座岛屿。由于全球变暖导致了海面上升,科学家预测未来几十年,岛屿边缘一个像素的范围会被海水淹没。具体来说如果一块陆地像素与...原创 2018-11-07 20:47:16 · 227 阅读 · 0 评论 -
2018年蓝桥杯B组c/c++ 第八题详解
标题:日志统计小明维护着一个程序员论坛。现在他收集了一份"点赞"日志,日志共有N行。其中每一行的格式是:ts id表示在ts时刻编号id的帖子收到一个"赞"。现在小明想统计有哪些帖子曾经是"热帖"。如果一个帖子曾在任意一个长度为D的时间段内收到不少于K个赞,小明就认为这个帖子曾是"热帖"。具体来说,如果存在某个时刻T满足该帖在[T, T+D)这段时间内(注意是左闭右开区间)收到不少于K个...原创 2018-11-07 20:30:49 · 434 阅读 · 0 评论 -
LeetCode 2. Add Two Numbers
/*You are given two non-empty linked lists representing two non-negative integers. The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and retur...原创 2018-11-10 20:41:44 · 83 阅读 · 0 评论 -
LeetCode 20. Valid Parentheses
/*Given a string containing just the characters ‘(’, ‘)’, ‘{’, ‘}’, ‘[’ and ‘]’,determine if the input string is valid.An input string is valid if:Open brackets must be closed by the same type of ...原创 2018-11-10 19:27:37 · 102 阅读 · 0 评论 -
LeetCode 21. Merge Two Sorted Lists
Merge two sorted linked lists and return it as a new list.The new list should be made by splicing together the nodes of the first two lists.Example:Input: 1->2->4, 1->3->4Output: 1->...原创 2018-11-10 19:23:54 · 97 阅读 · 0 评论 -
2018年蓝桥杯B组c/c++ 第六题详解
标题:递增三元组给定三个整数数组A = [A1, A2, … AN],B = [B1, B2, … BN],C = [C1, C2, … CN],请你统计有多少个三元组(i, j, k) 满足:1 <= i, j, k <= NAi < Bj < Ck【输入格式】第一行包含一个整数N。第二行包含N个整数A1, A2, … AN。第三行包含N个整数B...原创 2018-11-07 18:02:58 · 265 阅读 · 0 评论 -
2018年蓝桥杯B组c/c++ 第三题详解
标题:乘积尾零如下的10行数据,每行有10个整数,请你求出它们的乘积的末尾有多少个零?5650 4542 3554 473 946 4114 3871 9073 90 43292758 7949 6113 5659 5245 7432 3051 4434 6704 35949937 1173 6866 3397 4759 7557 3070 2287 1453 98991486 5722...原创 2018-11-07 16:58:31 · 168 阅读 · 0 评论 -
2018年蓝桥杯B组c/c++ 第十题详解
标题:乘积最大给定N个整数A1, A2, … AN。请你从中选出K个数,使其乘积最大。请你求出最大的乘积,由于乘积可能超出整型范围,你只需输出乘积除以1000000009的余数。注意,如果X&lt;0, 我们定义X除以1000000009的余数是负(-X)除以1000000009的余数。即:0-((0-x) % 1000000009)【输入格式】第一行包含两个整数N和K。以下N行每行...原创 2018-11-07 16:47:07 · 294 阅读 · 0 评论 -
Leetcode 12. Integer to Roman
Roman numerals are represented by seven different symbols: I, V, X, L, C, D and M.Symbol ValueI 1V 5X 10L 50C 100D ...原创 2018-11-28 20:47:13 · 95 阅读 · 0 评论