摘要: Given an array nums, there is a sliding window of size k which is moving from the very left of the array to the very right. You can only see the k num 阅读全文
posted @ 2018-10-03 14:44 elsie12 阅读(90) 评论(0) 推荐(0) 编辑
摘要: Implement an iterator over a binary search tree (BST). Your iterator will be initialized with the root node of a BST. Calling next() will return the n 阅读全文
posted @ 2018-10-01 15:47 elsie12 阅读(84) 评论(0) 推荐(0) 编辑
摘要: Given n nodes labeled from 0 to n-1 and a list of undirected edges (each edge is a pair of nodes), write a function to check whether these edges make 阅读全文
posted @ 2018-10-01 13:27 elsie12 阅读(131) 评论(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. 1. DP Set an array, first 阅读全文
posted @ 2018-09-29 00:41 elsie12 阅读(158) 评论(0) 推荐(0) 编辑
摘要: Remove the minimum number of invalid parentheses in order to make the input string valid. Return all possible results. Note: The input string may cont 阅读全文
posted @ 2018-09-28 06:01 elsie12 阅读(95) 评论(0) 推荐(0) 编辑
摘要: There are a total of n courses you have to take, labeled from 0 to n-1. Some courses may have prerequisites, for example to take course 0 you have to 阅读全文
posted @ 2018-09-27 02:35 elsie12 阅读(109) 评论(0) 推荐(0) 编辑
摘要: 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 @ 2018-09-26 06:28 elsie12 阅读(75) 评论(0) 推荐(0) 编辑
摘要: There are n cities connected by m flights. Each fight starts from city u and arrives at v with a price w. Now given all the cities and fights, togethe 阅读全文
posted @ 2018-09-26 03:09 elsie12 阅读(151) 评论(0) 推荐(0) 编辑
摘要: Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, 阅读全文
posted @ 2018-09-25 10:31 elsie12 阅读(87) 评论(0) 推荐(0) 编辑
摘要: There are two sorted arrays nums1 and nums2 of size m and n respectively. Find the median of the two sorted arrays. The overall run time complexity sh 阅读全文
posted @ 2018-09-25 04:49 elsie12 阅读(80) 评论(0) 推荐(0) 编辑