摘要: There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every 阅读全文
posted @ 2016-08-16 21:26 西小贝 阅读(154) 评论(0) 推荐(0) 编辑
摘要: Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assum 阅读全文
posted @ 2016-08-16 20:51 西小贝 阅读(126) 评论(0) 推荐(0) 编辑
摘要: 转:链接: Python:显示程序运行进度条 1、\r 2、tqdm 阅读全文
posted @ 2016-08-15 15:42 西小贝 阅读(875) 评论(0) 推荐(0) 编辑
摘要: For a undirected graph with tree characteristics, we can choose any node as the root. The result graph is then a rooted tree. Among all possible roote 阅读全文
posted @ 2016-08-14 14:52 西小贝 阅读(177) 评论(0) 推荐(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 permitte 阅读全文
posted @ 2016-08-12 15:36 西小贝 阅读(137) 评论(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-08-11 10:03 西小贝 阅读(128) 评论(0) 推荐(0) 编辑
摘要: 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-08-09 19:59 西小贝 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Write a program to find the n-th ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 阅读全文
posted @ 2016-08-09 10:54 西小贝 阅读(187) 评论(0) 推荐(0) 编辑
摘要: Given an array of numbers nums, in which exactly two elements appear only once and all the other elements appear exactly twice. Find the two elements 阅读全文
posted @ 2016-08-08 14:58 西小贝 阅读(109) 评论(0) 推荐(0) 编辑
摘要: Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th 阅读全文
posted @ 2016-08-08 10:34 西小贝 阅读(107) 评论(0) 推荐(0) 编辑