随笔分类 -  Level 3

摘要:Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), retur 阅读全文
posted @ 2016-07-31 11:50 北叶青藤 阅读(163) 评论(0) 推荐(0)
摘要:Flip Game I Problem Description: You are playing the following Flip Game with your friend: Given a string that contains only these two characters: + a 阅读全文
posted @ 2016-07-30 01:17 北叶青藤 阅读(148) 评论(0) 推荐(0)
摘要:Word Pattern | Given a pattern and a string str, find if str follows the same pattern. Examples: Notes: solution: Split the string, and add the pair t 阅读全文
posted @ 2016-07-29 23:44 北叶青藤 阅读(273) 评论(0) 推荐(0)
摘要:Given a list of words and two words word1 and word2, return the shortest distance between these two words in the list. For example, Assume that words 阅读全文
posted @ 2016-07-28 11:38 北叶青藤 阅读(217) 评论(0) 推荐(0)
摘要:Convert a non-negative integer to its english words representation. Given input is guaranteed to be less than 231 - 1. For example, 123 -> "One Hundre 阅读全文
posted @ 2016-07-28 05:27 北叶青藤 阅读(240) 评论(0) 推荐(0)
摘要:Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 el 阅读全文
posted @ 2016-07-27 11:13 北叶青藤 阅读(194) 评论(0) 推荐(0)
摘要:Given a non-empty array of integers, return the k most frequent elements. For example,Given [1,1,1,2,2,3] and k = 2, return [1,2]. 分析: http://blog.csd 阅读全文
posted @ 2016-07-27 01:24 北叶青藤 阅读(213) 评论(0) 推荐(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-07-26 23:43 北叶青藤 阅读(321) 评论(0) 推荐(0)
摘要: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:Given bi 阅读全文
posted @ 2016-07-26 01:03 北叶青藤 阅读(208) 评论(0) 推荐(0)
摘要:Implement function atoi to convert a string to an integer. If no valid conversion could be performed, a zero value is returned. If the correct value i 阅读全文
posted @ 2016-07-23 05:22 北叶青藤 阅读(221) 评论(0) 推荐(0)
摘要:Regular Expression Matching Implement regular expression matching with support for '.' and '*'. '.' Matches any single character. '*' Matches zero or 阅读全文
posted @ 2016-07-23 02:51 北叶青藤 阅读(213) 评论(0) 推荐(0)
摘要:Given an directed graph, a topological order of the graph nodes is defined as follow: For each directed edge A -> B in graph, A must before B in the o 阅读全文
posted @ 2016-07-22 09:56 北叶青藤 阅读(198) 评论(0) 推荐(0)
摘要:Given two arrays of length m and n with digits 0-9 representing two numbers. Create the maximum number of length k <= m + n from digits of the two. Th 阅读全文
posted @ 2016-07-22 04:15 北叶青藤 阅读(238) 评论(0) 推荐(0)
摘要:Given a nested list of integers, implement an iterator to flatten it. Each element is either an integer, or a list -- whose elements may also be integ 阅读全文
posted @ 2016-07-22 00:28 北叶青藤 阅读(213) 评论(0) 推荐(0)
摘要:Given an expression string array, return the Reverse Polish notation of this expression. (remove the parentheses) Given an expression string array, re 阅读全文
posted @ 2016-07-21 11:52 北叶青藤 阅读(306) 评论(0) 推荐(0)
摘要:Given n points on a 2D plane, find the maximum number of points that lie on the same straight line. Example Given 4 points: (1,2), (3,6), (0,0), (1,3) 阅读全文
posted @ 2016-07-21 01:28 北叶青藤 阅读(261) 评论(0) 推荐(0)
摘要:Given an interval list which are flying and landing time of the flight. How many airplanes are on the sky at most? Notice If landing and flying happen 阅读全文
posted @ 2016-07-20 23:18 北叶青藤 阅读(278) 评论(0) 推荐(0)
摘要:Given a set of n nuts of different sizes and n bolts of different sizes. There is a one-one mapping between nuts and bolts. Comparison of a nut to ano 阅读全文
posted @ 2016-07-20 22:42 北叶青藤 阅读(274) 评论(0) 推荐(0)
摘要:Given two 32-bit numbers, N and M, and two bit positions, i and j. Write a method to set all bits between i and j in N equal to M (e g , M becomes a s 阅读全文
posted @ 2016-07-20 04:46 北叶青藤 阅读(227) 评论(0) 推荐(0)
摘要:Given an integer matrix, find a submatrix where the sum of numbers is zero. Your code should return the coordinate of the left-up and right-down numbe 阅读全文
posted @ 2016-07-20 04:04 北叶青藤 阅读(344) 评论(0) 推荐(0)