随笔分类 -  RP

摘要:Find Minimum in Rotated Sorted Array I Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 阅读全文
posted @ 2016-07-17 22:15 北叶青藤 阅读(181) 评论(0) 推荐(0)
摘要:Given an absolute path for a file (Unix-style), simplify it. Have you met this question in a real interview? Yes Example "/home/", => "/home" "/a/./b/ 阅读全文
posted @ 2016-07-17 01:02 北叶青藤 阅读(218) 评论(0) 推荐(0)
摘要:Integer to Roman Given an integer, convert it to a roman numeral. The number is guaranteed to be within the range from 1 to 3999. Integer to Roman Giv 阅读全文
posted @ 2016-07-16 23:04 北叶青藤 阅读(232) 评论(0) 推荐(0)
摘要:Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from t 阅读全文
posted @ 2016-07-16 11:39 北叶青藤 阅读(190) 评论(0) 推荐(0)
摘要:Given a string source and a string target, find the minimum window in source which will contain all the characters in target. Notice If there is no su 阅读全文
posted @ 2016-07-16 05:04 北叶青藤 阅读(385) 评论(0) 推荐(0)
摘要:Given a m x n matrix, if an element is 0, set its entire row and column to 0. Do it in place. Have you met this question in a real interview? Yes Exam 阅读全文
posted @ 2016-07-15 23:22 北叶青藤 阅读(187) 评论(0) 推荐(0)
摘要:Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and put. get(key) - Get the 阅读全文
posted @ 2016-07-15 22:48 北叶青藤 阅读(380) 评论(0) 推荐(0)
摘要: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)
摘要:Determine the number of bits required to flip if you want to convert integer n to integer m. Notice Both n and m are 32-bit integers. Determine the nu 阅读全文
posted @ 2016-07-15 05:31 北叶青藤 阅读(204) 评论(0) 推荐(0)
摘要:Given n pieces of wood with length L[i] (integer array). Cut them into small pieces to guarantee you could have equal or more than k pieces with the s 阅读全文
posted @ 2016-07-15 03:39 北叶青藤 阅读(248) 评论(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)
摘要:Given n non-negative integers a1, a2, ..., an , where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endp 阅读全文
posted @ 2016-07-14 08:50 北叶青藤 阅读(158) 评论(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)
摘要:Valid Parentheses Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. Example The b 阅读全文
posted @ 2016-07-13 11:03 北叶青藤 阅读(260) 评论(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)