摘要: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. Given a positive integer n 阅读全文
posted @ 2017-11-12 14:27 Review->Improve 阅读(188) 评论(0) 推荐(0) 编辑
摘要: Given a knight in a chessboard n * m (a binary matrix with 0 as empty and 1 as barrier). the knight initial position is (0, 0) and he wants to reach p 阅读全文
posted @ 2017-11-12 13:56 Review->Improve 阅读(879) 评论(0) 推荐(0) 编辑
摘要: Given a knight in a chessboard (a binary matrix with 0 as empty and 1 as barrier) with a sourceposition, find the shortest path to a destination posit 阅读全文
posted @ 2017-11-12 13:32 Review->Improve 阅读(430) 评论(0) 推荐(0) 编辑
摘要: Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or  阅读全文
posted @ 2017-11-12 13:21 Review->Improve 阅读(193) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, find the maximum path sum. The path may start and end at any node in the tree. Given a binary tree, find the maximum path sum. Th 阅读全文
posted @ 2017-11-12 11:06 Review->Improve 阅读(418) 评论(0) 推荐(0) 编辑
摘要: Given a triangle, find the minimum path sum from top to bottom. Each step you may move to adjacent numbers on the row below. Bonus point if you are ab 阅读全文
posted @ 2017-11-12 11:02 Review->Improve 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right which minimizes the sum of all numbers along its path. 阅读全文
posted @ 2017-11-12 10:11 Review->Improve 阅读(312) 评论(0) 推荐(0) 编辑
摘要: Follow up for "Unique Paths": Now consider if some obstacles are added to the grids. How many unique paths would there be? An obstacle and empty space 阅读全文
posted @ 2017-11-12 09:36 Review->Improve 阅读(205) 评论(0) 推荐(0) 编辑
摘要: A robot is located at the top-left corner of a m x n grid. The robot can only move either down or right at any point in time. The robot is trying to r 阅读全文
posted @ 2017-11-12 09:15 Review->Improve 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Determine the number of bits required to flip if you want to convert integer n to integer m. Both n and m are 32-bit integers. Determine the number of 阅读全文
posted @ 2017-11-12 07:13 Review->Improve 阅读(223) 评论(0) 推荐(0) 编辑
摘要: Using O(1) time to check whether an integer n is a power of 2. Using O(1) time to check whether an integer n is a power of 2. Using O(1) time to check 阅读全文
posted @ 2017-11-12 07:08 Review->Improve 阅读(244) 评论(0) 推荐(0) 编辑
摘要: Count how many 1 in binary representation of a 32-bit integer. Count how many 1 in binary representation of a 32-bit integer. Count how many 1 in bina 阅读全文
posted @ 2017-11-12 07:07 Review->Improve 阅读(175) 评论(0) 推荐(0) 编辑
摘要: Bit Rotation -—— A rotation (or circular shift) is an operation similar to shift except that the bits that fall off at one end are put back to the oth 阅读全文
posted @ 2017-11-12 06:38 Review->Improve 阅读(613) 评论(0) 推荐(0) 编辑
摘要: Given n nodes in a graph labeled from 1 to n. There is no edges in the graph at beginning. You need to support the following method:1. connect(a, b), 阅读全文
posted @ 2017-11-12 02:25 Review->Improve 阅读(225) 评论(0) 推荐(0) 编辑
摘要: Given n nodes in a graph labeled from 1 to n. There is no edges in the graph at beginning. You need to support the following method:1. connect(a, b), 阅读全文
posted @ 2017-11-12 02:23 Review->Improve 阅读(231) 评论(0) 推荐(0) 编辑
摘要: Given n nodes in a graph labeled from 1 to n. There is no edges in the graph at beginning. You need to support the following method: 1. connect(a, b), 阅读全文
posted @ 2017-11-12 02:14 Review->Improve 阅读(587) 评论(0) 推荐(0) 编辑
摘要: Find the number Weak Connected Component in the directed graph. Each node in the graph contains a label and a list of its neighbors. (a weak connected 阅读全文
posted @ 2017-11-12 01:50 Review->Improve 阅读(603) 评论(0) 推荐(0) 编辑