461. Hamming Distance
摘要:The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Given two integers x and y, calcul
阅读全文
posted @
2017-07-27 12:45
Beserious
阅读(186)
推荐(0) 编辑
160. Intersection of Two Linked Lists
摘要:Write a program to find the node at which the intersection of two singly linked lists begins. For example, the following two linked lists: begin to in
阅读全文
posted @
2017-07-26 13:28
Beserious
阅读(134)
推荐(0) 编辑
169. Majority Element
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the
阅读全文
posted @
2017-07-26 12:14
Beserious
阅读(128)
推荐(0) 编辑
171. Excel Sheet Column Number
摘要:Related to question Excel Sheet Column Title Given a column title as appear in an Excel sheet, return its corresponding column number. For example: 从2
阅读全文
posted @
2017-07-26 08:07
Beserious
阅读(181)
推荐(0) 编辑
168. Excel Sheet Column Title
摘要:Given a positive integer, return its corresponding column title as appear in an Excel sheet. For example: 其实类似26进制数
阅读全文
posted @
2017-07-26 07:58
Beserious
阅读(133)
推荐(0) 编辑
189. Rotate Array
摘要:Rotate an array of n elements to the right by k steps. For example, with n = 7 and k = 3, the array [1,2,3,4,5,6,7] is rotated to [5,6,7,1,2,3,4]. Not
阅读全文
posted @
2017-07-25 18:35
Beserious
阅读(103)
推荐(0) 编辑
172. Factorial Trailing Zeroes
摘要:Given an integer n, return the number of trailing zeroes in n!. Note: Your solution should be in logarithmic time complexity. 求n得阶层,末尾0的个数 老问题了,统计2,5的
阅读全文
posted @
2017-07-25 15:21
Beserious
阅读(71)
推荐(0) 编辑
176. Second Highest Salary
摘要:Write a SQL query to get the second highest salary from the Employee table. For example, given the above Employee table, the query should return 200 a
阅读全文
posted @
2017-07-25 12:28
Beserious
阅读(115)
推荐(0) 编辑
167. Two Sum II - Input array is sorted (二分ortwo-pointer)
摘要: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
阅读全文
posted @
2017-07-25 11:54
Beserious
阅读(117)
推荐(0) 编辑
155. Min Stack
摘要:Design a stack that supports push, pop, top, and retrieving the minimum element in constant time. push(x) -- Push element x onto stack. pop() -- Remov
阅读全文
posted @
2017-07-25 11:12
Beserious
阅读(141)
推荐(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? 一个+1 一个+2 看看能不能相遇。注意代码不要写乱了...以后尽量用p1 p2
阅读全文
posted @
2017-07-24 20:38
Beserious
阅读(116)
推荐(0) 编辑
136. Single Number
摘要:Given an array of integers, every element appears twice except for one. Find that single one. Note:Your algorithm should have a linear runtime complex
阅读全文
posted @
2017-07-24 17:36
Beserious
阅读(118)
推荐(0) 编辑
125. Valid Palindrome
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan
阅读全文
posted @
2017-07-24 17:30
Beserious
阅读(144)
推荐(0) 编辑
122. Best Time to Buy and Sell Stock II
摘要:Say you have an array for which the ith element is the price of a given stock on day i. Design an algorithm to find the maximum profit. You may comple
阅读全文
posted @
2017-07-24 16:09
Beserious
阅读(129)
推荐(0) 编辑
121. Best Time to Buy and Sell Stock
摘要:Say you have an array for which the ith element is the price of a given stock on day i. If you were only permitted to complete at most one transaction
阅读全文
posted @
2017-07-24 14:54
Beserious
阅读(132)
推荐(0) 编辑
119. Pascal's Triangle II
摘要:Given an index k, return the kth row of the Pascal's triangle. For example, given k = 3,Return [1,3,3,1]. Note:Could you optimize your algorithm to us
阅读全文
posted @
2017-07-24 12:48
Beserious
阅读(166)
推荐(0) 编辑
118. Pascal's Triangle
摘要:Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5,Return 注意左右的边界赋值
阅读全文
posted @
2017-07-24 12:19
Beserious
阅读(124)
推荐(0) 编辑
112. Path Sum
摘要:Given a binary tree and a sum, determine if the tree has a root-to-leaf path such that adding up all the values along the path equals the given sum. F
阅读全文
posted @
2017-07-24 11:54
Beserious
阅读(110)
推荐(0) 编辑
111. Minimum Depth of Binary Tree
摘要:Given a binary tree, find its minimum depth. The minimum depth is the number of nodes along the shortest path from the root node down to the nearest l
阅读全文
posted @
2017-07-24 11:30
Beserious
阅读(110)
推荐(0) 编辑
110. Balanced Binary Tree
摘要:Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as a binary tree in which the dept
阅读全文
posted @
2017-07-24 10:48
Beserious
阅读(123)
推荐(0) 编辑