LeetCode
雄性皮卡丘
。。
展开
-
70. Climbing Stairs
LeetCode70.Climbing Stairs原创 2016-07-26 13:39:05 · 205 阅读 · 0 评论 -
36. Valid Sudoku | LeetCode
36. Valid Sudoku | LeetCode原创 2016-08-06 21:22:13 · 248 阅读 · 0 评论 -
299. Bulls and Cows | LeetCode
299. Bulls and Cows原创 2016-08-08 00:56:51 · 239 阅读 · 3 评论 -
374. Guess Number Higher or Lower | LeetCode
374. Guess Number Higher or Lower | LeetCode原创 2016-08-12 01:30:29 · 192 阅读 · 0 评论 -
LeetCode | 461. Hamming Distance
461. Hamming Distance原创 2017-03-03 21:53:34 · 263 阅读 · 0 评论 -
LeetCode | 412. Fizz Buzz
Write a program that outputs the string representation of numbers from 1 to n. But for multiples of three it should output “Fizz” instead of the number and for the multiples of five output “Buzz”.原创 2017-03-08 19:47:11 · 299 阅读 · 0 评论 -
LeetCode | 492. Construct the Rectangle
For a web developer, it is very important to know how to design a web page’s size. So, given a specific rectangular web page’s area, your job by now is to design a rectangular web page, whose length L原创 2017-03-19 22:27:39 · 174 阅读 · 0 评论 -
LeetCode | 448. Find All Numbers Disappeared in an Array【经典题】
Given an array of integers where 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements of [1, n] inclusive that do not appear in this array.原创 2017-03-20 20:41:43 · 157 阅读 · 0 评论 -
LeetCode | 500. Keyboard Row
500. Keyboard Row原创 2017-03-07 20:49:09 · 494 阅读 · 0 评论 -
LeetCode | 530. Minimum Absolute Difference in BST
Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. 题目链接 最容易想到的方法,由于是BST,直接中序遍历后即可得到排序后的list,再把排序后的list两两比较找出相差最小的值即可。/** * Def原创 2017-03-21 18:31:32 · 282 阅读 · 0 评论 -
LeetCode | 383. Ransom Note
Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the ransom note can be constructed from the magazines ; oth原创 2017-03-28 22:49:35 · 239 阅读 · 0 评论 -
LeetCode | 506. Relative Ranks
Given scores of N athletes, find their relative ranks and the people with the top three highest scores, who will be awarded medals: “Gold Medal”, “Silver Medal” and “Bronze Medal”. Example 1: I原创 2017-03-22 21:32:05 · 205 阅读 · 0 评论 -
LeetCode | 463. Island Perimeter
You are given a map in form of a two-dimensional integer grid where 1 represents land and 0 represents water. Grid cells are connected horizontally/vertically (not diagonally). The grid is completely s原创 2017-03-13 20:43:48 · 251 阅读 · 0 评论 -
LeetCode | 167. Two Sum II - Input array is sorted
Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target number. The function twoSum should return indices of the two numbe原创 2017-03-23 15:23:09 · 173 阅读 · 0 评论 -
LeetCode | 485. Max Consecutive Ones
Given a binary array, find the maximum number of consecutive 1s in this array. Example 1: Input: [1,1,0,1,1,1] Output: 3 Explanation: The first two digits or the last three digits are con原创 2017-03-14 21:04:09 · 300 阅读 · 0 评论 -
LeetCode | 455. Assign Cookies
Assume you are an awesome parent and want to give your children some cookies. But, you should give each child at most one cookie. Each child i has a greed factor gi, which is the minimum size of a cook原创 2017-03-24 19:49:51 · 193 阅读 · 0 评论 -
LeetCode | 496. Next Greater Element I
You are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next greater numbers for nums1’s elements in the corresponding places of nums2.原创 2017-03-15 19:52:58 · 167 阅读 · 0 评论 -
LeetCode | 453. Minimum Moves to Equal Array Elements
Given a non-empty integer array of size n, find the minimum number of moves required to make all array elements equal, where a move is incrementing n - 1 elements by 1. Example: Input: [1,2,原创 2017-03-26 11:44:06 · 245 阅读 · 0 评论 -
112. Path Sum | LeetCode
112. Path Sum | LeetCode原创 2016-08-06 18:49:05 · 189 阅读 · 0 评论 -
9. Palindrome Number | LeetCode
9. Palindrome Number | LeetCode原创 2016-08-06 16:49:48 · 206 阅读 · 0 评论 -
172. Factorial Trailing Zeroes
172. Factorial Trailing Zeroes原创 2016-08-05 23:57:45 · 192 阅读 · 0 评论 -
121. Best Time to Buy and Sell Stock
LeetCode 121. Best Time to Buy and Sell Stock原创 2016-07-26 15:42:10 · 180 阅读 · 0 评论 -
141. Linked List Cycle
Given a linked list, determine if it has a cycle in it. Follow up: Can you solve it without using extra space? 哈希表求解简单处理就是将数据存放到哈希表,遍历的过程中判断是否存在,若存在说明有环。但是此算法在空间复杂度和时间复杂度上均为O(n)O(n),性能不佳。代码如下:pub原创 2016-07-26 16:43:39 · 162 阅读 · 0 评论 -
21. Merge Two Sorted Lists
21. Merge Two Sorted Lists原创 2016-07-27 14:12:01 · 139 阅读 · 0 评论 -
345. Reverse Vowels of a String
345. Reverse Vowels of a String原创 2016-07-27 15:47:40 · 285 阅读 · 0 评论 -
24. Swap Nodes in Pairs
24. Swap Nodes in Pairs原创 2016-07-27 17:01:01 · 167 阅读 · 0 评论 -
66. Plus One
66. Plus One原创 2016-08-03 21:25:39 · 221 阅读 · 0 评论 -
101. Symmetric Tree.md
101. Symmetric Tree原创 2016-08-03 21:43:27 · 263 阅读 · 0 评论 -
110. Balanced Binary Tree
110. Balanced Binary Tree原创 2016-08-04 00:31:24 · 193 阅读 · 0 评论 -
232. Implement Queue using Stacks
232. Implement Queue using Stacks.md原创 2016-08-04 15:22:31 · 168 阅读 · 0 评论 -
118. Pascal's Triangle
118. Pascal's Triangle原创 2016-08-04 14:48:41 · 164 阅读 · 0 评论 -
26. Remove Duplicates from Sorted Array
26. Remove Duplicates from Sorted Array原创 2016-08-04 15:55:04 · 176 阅读 · 0 评论 -
198. House Robber
198. House Robber原创 2016-08-02 01:03:28 · 168 阅读 · 0 评论 -
102. Binary Tree Level Order Traversal
102. Binary Tree Level Order Traversal原创 2016-08-05 19:58:23 · 170 阅读 · 0 评论 -
119. Pascal's Triangle II
119. Pascal's Triangle II原创 2016-08-05 20:46:22 · 169 阅读 · 0 评论 -
107. Binary Tree Level Order Traversal II
107. Binary Tree Level Order Traversal II原创 2016-08-02 18:08:11 · 174 阅读 · 0 评论 -
342. Power of Four
342. Power of Four原创 2016-08-02 18:09:43 · 145 阅读 · 0 评论 -
27. Given an array and a value
27. Given an array and a value原创 2016-08-02 19:39:11 · 338 阅读 · 0 评论 -
LeetCode | 520. Detect Capital
Given a word, you need to judge whether the usage of capitals in it is right or not. We define the usage of capitals in a word to be right when one of the following cases holds: All letters i原创 2017-03-16 19:38:05 · 236 阅读 · 0 评论