随笔分类 -  Great Questions

摘要:Given an array with n objects colored red, white or blue, sort them so that objects of the same color are adjacent, with the colors in the order red, 阅读全文
posted @ 2016-07-15 12:57 北叶青藤 阅读(190) 评论(0) 推荐(0)
摘要:Next Permutation Given a list of integers, which denote a permutation. Find the next permutation in ascending order. Notice The list may contains dupl 阅读全文
posted @ 2016-07-15 11:52 北叶青藤 阅读(275) 评论(0) 推荐(0)
摘要:Given string A representative a positive integer which has N digits, remove any k digits of the number, the remaining digits are arranged according to 阅读全文
posted @ 2016-07-15 05:15 北叶青藤 阅读(169) 评论(0) 推荐(0)
摘要: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 cost 阅读全文
posted @ 2016-07-15 02:06 北叶青藤 阅读(280) 评论(0) 推荐(0)
摘要:Give you an integer array (index from 0 to n-1, where n is the size of this array, value from 0 to 10000) . For each element Ai in the array, count th 阅读全文
posted @ 2016-07-14 21:16 北叶青藤 阅读(362) 评论(0) 推荐(0)
摘要:Given n non-negative integers representing an elevation map where the width of each bar is 1, compute how much water it is able to trap after raining. 阅读全文
posted @ 2016-07-14 09:02 北叶青藤 阅读(241) 评论(0) 推荐(0)
摘要:Insert Intervals Given a non-overlapping interval list which is sorted by start point. Insert a new interval into it, make sure the list is still in o 阅读全文
posted @ 2016-07-14 03:57 北叶青藤 阅读(266) 评论(0) 推荐(0)
摘要:Find the kth smallest number in at row and column sorted matrix. Example Given k = 4 and a matrix: [ [1 ,5 ,7], [3 ,7 ,8], [4 ,8 ,9], ] return 5. 分析: 阅读全文
posted @ 2016-07-14 02:29 北叶青藤 阅读(308) 评论(0) 推荐(0)
摘要:Divide two integers without using multiplication, division and mod operator. If it is overflow, return 2147483647 Example Given dividend = 100 and div 阅读全文
posted @ 2016-07-13 22:39 北叶青藤 阅读(167) 评论(0) 推荐(0)
摘要:Determine whether a Sudoku is valid. The Sudoku board could be partially filled, where empty cells are filled with the character .. Notice A valid Sud 阅读全文
posted @ 2016-07-13 12:02 北叶青藤 阅读(209) 评论(0) 推荐(0)
摘要:Given a boolean 2D matrix, find the number of islands. Notice 0 is represented as the sea, 1 is represented as the island. If two 1 is adjacent, we co 阅读全文
posted @ 2016-07-13 10:39 北叶青藤 阅读(234) 评论(0) 推荐(0)
摘要:Given a string containing only digits, restore it by returning all possible valid IP address combinations. Given a string containing only digits, rest 阅读全文
posted @ 2016-07-13 09:56 北叶青藤 阅读(206) 评论(0) 推荐(0)
摘要:Design a data structure that supports the following two operations: addWord(word) andsearch(word) search(word) can search a literal word or a regular 阅读全文
posted @ 2016-07-13 05:58 北叶青藤 阅读(253) 评论(0) 推荐(0)
摘要:Given an unsorted array nums, reorder it in-place such that nums[0] <= nums[1] >= nums[2] <= nums[3].... Notice Please complete the problem in-place. 阅读全文
posted @ 2016-07-12 23:56 北叶青藤 阅读(281) 评论(0) 推荐(0)
摘要:A message containing letters from A-Z is being encoded to numbers using the following mapping: 'A' -> 1 'B' -> 2 ... 'Z' -> 26 Given an encoded messag 阅读全文
posted @ 2016-07-12 02:45 北叶青藤 阅读(229) 评论(0) 推荐(0)
摘要:House Robber You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constrain 阅读全文
posted @ 2016-07-12 00:26 北叶青藤 阅读(231) 评论(0) 推荐(0)
摘要:Coins in a Line I There are n coins in a line. Two players take turns to take one or two coins from right side until there are no more coins left. The 阅读全文
posted @ 2016-07-10 04:06 北叶青藤 阅读(210) 评论(0) 推荐(0)
摘要:Given a string s, partition s such that every substring of the partition is a palindrome. Return all possible palindrome partitioning of s. Given a st 阅读全文
posted @ 2016-07-09 09:23 北叶青藤 阅读(200) 评论(0) 推荐(0)
摘要:There is a fence with n posts, each post can be painted with one of the k colors.You have to paint all the posts such that no more than two adjacent f 阅读全文
posted @ 2016-07-09 06:41 北叶青藤 阅读(295) 评论(0) 推荐(0)
摘要:For a Maximum Segment Tree, which each node has an extra value max to store the maximum value in this node's interval. Implement a modify function wit 阅读全文
posted @ 2016-07-09 02:19 北叶青藤 阅读(176) 评论(0) 推荐(0)