随笔分类 -  LeetCode

1 2 3 4 5 ··· 7 下一页
摘要:O(n) look for the median(or any target rank) in an array 1 class Solution { 2 public static void main(String[] args) { 3 Solution solution = new Solut 阅读全文
posted @ 2021-01-12 03:22 新一代的天皇巨星 阅读(118) 评论(0) 推荐(0)
摘要:630. Course Schedule III There are n different online courses numbered from 1 to n. Each course has some duration(course length) t and closed on dthda 阅读全文
posted @ 2017-08-05 12:07 新一代的天皇巨星 阅读(349) 评论(0) 推荐(0)
摘要:621. Task Scheduler Given a char array representing tasks CPU need to do. It contains capital letters A to Z where different letters represent differe 阅读全文
posted @ 2017-07-18 22:43 新一代的天皇巨星 阅读(219) 评论(0) 推荐(0)
摘要:72. Edit Distance Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 阅读全文
posted @ 2016-09-01 06:00 新一代的天皇巨星 阅读(178) 评论(0) 推荐(0)
摘要:56. Merge Intervals Given a collection of intervals, merge all overlapping intervals. For example,Given [1,3],[2,6],[8,10],[15,18],return [1,6],[8,10] 阅读全文
posted @ 2016-08-26 13:24 新一代的天皇巨星 阅读(192) 评论(0) 推荐(0)
摘要:32. Longest Valid Parentheses Given a string containing just the characters '(' and ')', find the length of the longest valid (well-formed) parenthese 阅读全文
posted @ 2016-08-17 04:33 新一代的天皇巨星 阅读(194) 评论(0) 推荐(0)
摘要:384. Shuffle an Array Shuffle a set of numbers without duplicates. Example: // Init an array with set 1, 2, and 3. int[] nums = {1,2,3}; Solution solu 阅读全文
posted @ 2016-08-12 10:03 新一代的天皇巨星 阅读(740) 评论(0) 推荐(0)
摘要:232. Implement Queue using Stacks Implement the following operations of a queue using stacks. push(x) -- Push element x to the back of queue. pop() -- 阅读全文
posted @ 2016-08-01 06:20 新一代的天皇巨星 阅读(128) 评论(0) 推荐(0)
摘要:151. Reverse Words in a String Given an input string, reverse the string word by word. For example,Given s = "the sky is blue",return "blue is sky the 阅读全文
posted @ 2016-08-01 04:58 新一代的天皇巨星 阅读(227) 评论(0) 推荐(0)
摘要:96. Unique Binary Search Trees Given n, how many structurally unique BST's (binary search trees) that store values 1...n? For example,Given n = 3, the 阅读全文
posted @ 2016-07-31 08:24 新一代的天皇巨星 阅读(241) 评论(0) 推荐(0)
摘要:201. Bitwise AND of Numbers Range Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive 阅读全文
posted @ 2016-07-31 08:09 新一代的天皇巨星 阅读(123) 评论(0) 推荐(0)
摘要:221. Maximal Square Given a 2D binary matrix filled with 0's and 1's, find the largest square containing only 1's and return its area. For example, gi 阅读全文
posted @ 2016-07-27 13:58 新一代的天皇巨星 阅读(248) 评论(0) 推荐(0)
摘要:376. Wiggle Subsequence A sequence of numbers is called a wiggle sequence if the differences between successive numbers strictly alternate between pos 阅读全文
posted @ 2016-07-26 12:48 新一代的天皇巨星 阅读(751) 评论(0) 推荐(0)
摘要:331. Verify Preorder Serialization of a Binary Tree One way to serialize a binary tree is to use pre-order traversal. When we encounter a non-null nod 阅读全文
posted @ 2016-07-26 12:47 新一代的天皇巨星 阅读(159) 评论(0) 推荐(0)
摘要:127. Word Ladder Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from begin 阅读全文
posted @ 2016-07-25 11:16 新一代的天皇巨星 阅读(335) 评论(0) 推荐(0)
摘要:365. Water and Jug Problem You are given two jugs with capacities x and y litres. There is an infinite amount of water supply available. You need to d 阅读全文
posted @ 2016-07-25 10:02 新一代的天皇巨星 阅读(160) 评论(0) 推荐(0)
摘要:355. Design Twitter Design a simplified version of Twitter where users can post tweets, follow/unfollow another user and is able to see the 10 most re 阅读全文
posted @ 2016-07-25 08:04 新一代的天皇巨星 阅读(199) 评论(0) 推荐(0)
摘要:93. Restore IP Addresses Given a string containing only digits, restore it by returning all possible valid IP address combinations. For example:Given  阅读全文
posted @ 2016-07-25 08:03 新一代的天皇巨星 阅读(146) 评论(0) 推荐(0)
摘要:73. Set Matrix Zeroes Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Hide Tags Array Hide Similar Probl 阅读全文
posted @ 2016-07-25 07:33 新一代的天皇巨星 阅读(149) 评论(0) 推荐(0)
摘要:222. Count Complete Tree Nodes Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a compl 阅读全文
posted @ 2016-07-25 06:28 新一代的天皇巨星 阅读(107) 评论(0) 推荐(0)

1 2 3 4 5 ··· 7 下一页