2015年12月16日

200. Number of Islands (Graph)

摘要: Given a 2d grid map of '1's (land) and '0's (water), count the number of islands. An island is surrounded by water and is formed by connecting adjacen... 阅读全文

posted @ 2015-12-16 14:56 joannae 阅读(181) 评论(0) 推荐(0) 编辑

199. Binary Tree Right Side View (Tree, Stack)

摘要: Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom.For exam... 阅读全文

posted @ 2015-12-16 14:18 joannae 阅读(190) 评论(0) 推荐(0) 编辑

198. House Robber(Array; DP)

摘要: You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping yo... 阅读全文

posted @ 2015-12-16 13:29 joannae 阅读(176) 评论(0) 推荐(0) 编辑

191. Number of 1 Bits (Int; Bit)

摘要: Write a function that takes an unsigned integer and returns the number of ’1' bits it has (also known as the Hamming weight).For example, the 32-bit i... 阅读全文

posted @ 2015-12-16 12:37 joannae 阅读(156) 评论(0) 推荐(0) 编辑

190. Reverse Bits (Int; Bit)

摘要: Reverse bits of a given 32 bits unsigned integer.For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 阅读全文

posted @ 2015-12-16 12:29 joannae 阅读(199) 评论(0) 推荐(0) 编辑

189. Rotate Array(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].Note:... 阅读全文

posted @ 2015-12-16 10:58 joannae 阅读(155) 评论(0) 推荐(0) 编辑

188. Best Time to Buy and Sell Stock IV (Array; DP)

摘要: 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 complet... 阅读全文

posted @ 2015-12-16 08:46 joannae 阅读(132) 评论(0) 推荐(0) 编辑

导航