摘要: There are N gas stations along a circular route, where the amount of gas at station i is gas[i].You have a car with an unlimited gas tank and it costs 阅读全文
posted @ 2018-09-18 14:40 jasminemzy 阅读(118) 评论(0) 推荐(0) 编辑
摘要: Given a string, find the length of the longest substring T that contains at most k distinct characters.Example 1:Input: s = "eceba", k = 2Output: 3Exp 阅读全文
posted @ 2018-09-18 14:00 jasminemzy 阅读(232) 评论(0) 推荐(0) 编辑
摘要: Given a list accounts, each element accounts[i] is a list of strings, where the first element accounts[i][0] is a name, and the rest of the elements a 阅读全文
posted @ 2018-09-18 13:28 jasminemzy 阅读(231) 评论(0) 推荐(0) 编辑
摘要: Design a hit counter which counts the number of hits received in the past 5 minutes.Each function accepts a timestamp parameter (in seconds granularit 阅读全文
posted @ 2018-09-18 11:52 jasminemzy 阅读(186) 评论(0) 推荐(0) 编辑
摘要: Design a logger system that receive stream of messages along with its timestamps, each message should be printed if and only if it is not printed in t 阅读全文
posted @ 2018-09-18 11:46 jasminemzy 阅读(213) 评论(0) 推荐(0) 编辑
摘要: 496. Next Greater Element IYou are given two arrays (without duplicates) nums1 and nums2 where nums1’s elements are subset of nums2. Find all the next 阅读全文
posted @ 2018-09-18 09:32 jasminemzy 阅读(124) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return all duplicate subtrees. For each kind of duplicate subtrees, you only need to return the root node of any oneof them.Two t 阅读全文
posted @ 2018-09-18 08:33 jasminemzy 阅读(239) 评论(0) 推荐(0) 编辑
摘要: 54. Spiral MatrixGiven a matrix of m x n elements (m rows, n columns), return all elements of the matrix in spiral order.Example 1:Input:[ [1, 2, 3, 4 阅读全文
posted @ 2018-09-18 06:58 jasminemzy 阅读(155) 评论(0) 推荐(0) 编辑
摘要: Given an integer n, generate all structurally unique BST's (binary search trees) that store values 1 ... n. DFS.函数头:private List<TreeNode> dfs(int sta 阅读全文
posted @ 2018-09-18 06:13 jasminemzy 阅读(141) 评论(0) 推荐(0) 编辑
摘要: Given n, how many structurally unique BST's (binary search trees) that store values 1 ... n?Example:Input: 3Output: 5Explanation:Given n = 3, there ar 阅读全文
posted @ 2018-09-18 05:35 jasminemzy 阅读(132) 评论(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, together 阅读全文
posted @ 2018-09-18 05:04 jasminemzy 阅读(243) 评论(0) 推荐(0) 编辑
摘要: Evaluate the value of an arithmetic expression in Reverse Polish Notation.Valid operators are +, -, *, /. Each operand may be an integer or another ex 阅读全文
posted @ 2018-09-18 02:11 jasminemzy 阅读(119) 评论(0) 推荐(0) 编辑
摘要: Compare two version numbers version1 and version2.If version1 > version2 return 1; if version1 < version2 return -1;otherwise return 0.You may assume 阅读全文
posted @ 2018-09-18 01:37 jasminemzy 阅读(137) 评论(0) 推荐(0) 编辑
摘要: Given a list of daily temperatures, produce a list that, for each day in the input, tells you how many days you would have to wait until a warmer temp 阅读全文
posted @ 2018-09-18 01:06 jasminemzy 阅读(180) 评论(0) 推荐(0) 编辑