随笔分类 -  LeetCode

上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 61 下一页
摘要:Given a non-empty 2D matrix matrix and an integer k, find the max sum of a rectangle in the matrix such that its sum is no larger than k. Example: Inp 阅读全文
posted @ 2016-06-26 12:40 Grandyang 阅读(17714) 评论(15) 推荐(1) 编辑
摘要:Given a binary tree, collect a tree's nodes as if you were doing this: Collect and remove all leaves, repeat until the tree is empty. Example: Explana 阅读全文
posted @ 2016-06-25 12:34 Grandyang 阅读(16248) 评论(2) 推荐(0) 编辑
摘要:Given a nested list of integers, return the sum of all integers in the list weighted by their depth. Each element is either an integer, or a list -- w 阅读全文
posted @ 2016-06-24 23:35 Grandyang 阅读(14477) 评论(10) 推荐(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 granulari 阅读全文
posted @ 2016-06-22 01:00 Grandyang 阅读(20796) 评论(5) 推荐(1) 编辑
摘要:Given a 2D grid, each cell is either a wall 'W', an enemy 'E' or empty '0' (the number zero), return the maximum enemies you can kill using one bomb. 阅读全文
posted @ 2016-06-19 23:50 Grandyang 阅读(17616) 评论(3) 推荐(0) 编辑
摘要:Given a sorted array of integers nums and integer values a, band c. Apply a quadratic function of the form f(x) = ax2 + bx + c to each element x in th 阅读全文
posted @ 2016-06-18 06:58 Grandyang 阅读(11839) 评论(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 @ 2016-06-17 00:45 Grandyang 阅读(18806) 评论(0) 推荐(0) 编辑
摘要:Given a non-empty string s and an integer k, rearrange the string such that the same characters are at least distance k from each other. All input str 阅读全文
posted @ 2016-06-15 01:01 Grandyang 阅读(16092) 评论(3) 推荐(0) 编辑
摘要:Given a non-negative integer n, count all numbers with unique digits, x, where 0 ≤ x < 10n. Example: Given n = 2, return 91. (The answer should be the 阅读全文
posted @ 2016-06-14 04:12 Grandyang 阅读(13573) 评论(0) 推荐(2) 编辑
摘要:Given n points on a 2D plane, find if there is such a line parallel to y-axis that reflect the given points. Example 1: Input: [[1,1],[-1,1]] Output: 阅读全文
posted @ 2016-06-13 00:33 Grandyang 阅读(10369) 评论(7) 推荐(0) 编辑
摘要:Design a simplified version of Twitter where users can post tweets, follow/unfollow another user, and is able to see the 10 most recent tweets in the 阅读全文
posted @ 2016-06-12 11:39 Grandyang 阅读(11150) 评论(7) 推荐(0) 编辑
摘要:You have a number of envelopes with widths and heights given as a pair of integers (w, h). One envelope can fit into another if and only if both the w 阅读全文
posted @ 2016-06-08 00:56 Grandyang 阅读(17645) 评论(9) 推荐(1) 编辑
摘要:Design a Snake game that is played on a device with screen size = width x height. Play the game online if you are not familiar with the game. The snak 阅读全文
posted @ 2016-06-04 03:01 Grandyang 阅读(13379) 评论(6) 推荐(0) 编辑
摘要:Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen so far as a list of disjoint intervals. For exampl 阅读全文
posted @ 2016-06-01 04:24 Grandyang 阅读(10641) 评论(9) 推荐(0) 编辑
摘要:Given an Android 3x3 key lock screen and two integers m and n, where 1 ≤ m ≤ n ≤ 9, count the total number of unlock patterns of the Android lock scre 阅读全文
posted @ 2016-05-30 05:40 Grandyang 阅读(17871) 评论(12) 推荐(0) 编辑
摘要:Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2,2] Example 2: Input: n 阅读全文
posted @ 2016-05-27 06:21 Grandyang 阅读(18443) 评论(10) 推荐(1) 编辑
摘要:Given two arrays, write a function to compute their intersection. Example 1: Input: nums1 = [1,2,2,1], nums2 = [2,2] Output: [2] Example 2: Input: num 阅读全文
posted @ 2016-05-18 23:33 Grandyang 阅读(25775) 评论(5) 推荐(1) 编辑
摘要:Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the following rules: A move is guaranteed to be valid and 阅读全文
posted @ 2016-05-06 21:07 Grandyang 阅读(21592) 评论(5) 推荐(0) 编辑
摘要:Given a non-empty array of integers, return the k most frequent elements. Example 1: Example 2: Input: nums = [1], k = 1 Output: [1] Example 2: Note: 阅读全文
posted @ 2016-05-03 10:42 Grandyang 阅读(28875) 评论(8) 推荐(0) 编辑
摘要:Given a stream of integers and a window size, calculate the moving average of all integers in the sliding window. Example: MovingAverage m = new Movin 阅读全文
posted @ 2016-05-01 05:35 Grandyang 阅读(15356) 评论(0) 推荐(0) 编辑

上一页 1 ··· 39 40 41 42 43 44 45 46 47 ··· 61 下一页
Fork me on GitHub