随笔- 509
文章- 0
评论- 151
阅读-
22万
04 2015 档案
LeetCode - Isomorphic Strings
摘要:Isomorphic Strings2015.4.30 15:54Given two stringssandt, determine if they are isomorphic.Two strings are isomorphic if the characters inscan be repla...
阅读全文
LeetCode - Count Primes
摘要:Count Primes2015.4.30 15:51Count the number of prime numbers less than a non-negative number,nSolution: Sieve of Eratosthenes.Accepted code: 1 // 2CE...
阅读全文
LeetCode - Remove Linked List Elements
摘要:Remove Linked List Elements2015.4.30 15:00Remove all elements from a linked list of integers that have valueval.ExampleGiven:1 --> 2 --> 6 --> 3 --> 4...
阅读全文
LeetCode - Happy Number
摘要:Happy Number2015.4.22 12:39Write an algorithm to determine if a number is "happy".A happy number is a number defined by the following process: Startin...
阅读全文
LeetCode - Bitwise AND of Numbers Range
摘要:Bitwise AND of Numbers Range2015.4.17 06:30Given a range [m, n] where 0 m) { 6 n = (n & n - 1); 7 } 8 return m & n; 9 ...
阅读全文
LeetCode - Number of Islands
摘要:Number of Islands2015.4.17 06:16Given a 2d grid map of'1's (land) and'0's (water), count the number of islands. An island is surrounded by water and i...
阅读全文
LeetCode - Binary Tree Right Side View
摘要:Binary Tree Right Side View2015.4.17 06:04Given a binary tree, imagine yourself standing on therightside of it, return the values of the nodes you can...
阅读全文
LeetCode - House Robber
摘要:House Robber2015.4.17 05:52You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the ...
阅读全文
LeetCode - Number of 1 Bits
摘要:Number of 1 Bits2015.4.17 05:48Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as theHamming wei...
阅读全文
LeetCode - Reverse Bits
摘要:Reverse Bits2015.4.17 05:42Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as000000101001010...
阅读全文
LeetCode - Rotate Array
摘要:Rotate Array2015.4.17 05:37Rotate an array ofnelements to the right byksteps.For example, withn= 7 andk= 3, the array[1,2,3,4,5,6,7]is rotated to[5,6,...
阅读全文
LeetCode - Best Time to Buy and Sell Stock IV
摘要:Best Time to Buy and Sell Stock IV2015.4.17 05:27Say you have an array for which theithelement is the price of a given stock on dayi.Design an algorit...
阅读全文