摘要: Given a positive integer n, find the least number of perfect square numbers (for example, 1, 4, 9, 16, ...) which sum to n. For example, given n = 12, 阅读全文
posted @ 2016-07-01 15:54 Miller1991 阅读(141) 评论(0) 推荐(0) 编辑
摘要: You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you nee 阅读全文
posted @ 2016-07-01 15:34 Miller1991 阅读(421) 评论(0) 推荐(0) 编辑
摘要: Given a 2D matrix matrix, find the sum of the elements inside the rectangle defined by its upper left corner (row1, col1) and lower right corner (row2 阅读全文
posted @ 2016-07-01 14:49 Miller1991 阅读(198) 评论(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 @ 2016-07-01 14:16 Miller1991 阅读(237) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1...n. For example,Given n = 3, your program should 阅读全文
posted @ 2016-07-01 10:49 Miller1991 阅读(138) 评论(0) 推荐(0) 编辑
摘要: Given an integer array nums, find the sum of the elements between indices i and j (i ≤ j), inclusive. Example: Note: 注意边界 阅读全文
posted @ 2016-07-01 10:09 Miller1991 阅读(322) 评论(0) 推荐(0) 编辑