摘要: Given an array of n positive integers and a positive integer s, find the minimal length of a contiguous subarray of which the sum ≥ s. If there isn't 阅读全文
posted @ 2017-11-29 12:53 逸朵 阅读(150) 评论(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 t 阅读全文
posted @ 2017-11-29 12:39 逸朵 阅读(195) 评论(0) 推荐(0)
摘要: Implement a trie with insert, search, and startsWith methods. Note:You may assume that all inputs are consist of lowercase letters a-z. 阅读全文
posted @ 2017-11-29 09:42 逸朵 阅读(133) 评论(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 t 阅读全文
posted @ 2017-11-29 09:18 逸朵 阅读(143) 评论(0) 推荐(0)
摘要: Description: Count the number of prime numbers less than a non-negative number, n. 阅读全文
posted @ 2017-11-29 07:24 逸朵 阅读(137) 评论(0) 推荐(0)
摘要: Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given the range [5, 阅读全文
posted @ 2017-11-29 07:03 逸朵 阅读(123) 评论(0) 推荐(0)
摘要: 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 exa 阅读全文
posted @ 2017-11-29 06:07 逸朵 阅读(100) 评论(0) 推荐(0)
摘要: 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 @ 2017-11-29 05:58 逸朵 阅读(95) 评论(0) 推荐(0)
摘要: Given a list of non negative integers, arrange them such that they form the largest number. For example, given [3, 30, 34, 5, 9], the largest formed n 阅读全文
posted @ 2017-11-29 05:33 逸朵 阅读(124) 评论(0) 推荐(0)
摘要: The demons had captured the princess (P) and imprisoned her in the bottom-right corner of a dungeon. The dungeon consists of M x N rooms laid out in a 阅读全文
posted @ 2017-11-29 01:43 逸朵 阅读(131) 评论(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 @ 2017-11-29 01:24 逸朵 阅读(112) 评论(0) 推荐(0)