随笔分类 -  Level 2

上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页
摘要:From:http://bradforj287.blogspot.com/2010/11/efficient-circular-buffer-in-java.html 阅读全文
posted @ 2017-01-05 14:56 北叶青藤 阅读(290) 评论(0) 推荐(0)
摘要:This problem can be solved by using a heap. The time is O(nlog(n)). Given m arrays, the minimum elements of all arrays can form a heap. It takes O(log 阅读全文
posted @ 2017-01-05 08:52 北叶青藤 阅读(480) 评论(0) 推荐(0)
摘要:Given a string representing arbitrarily nested ternary expressions, calculate the result of the expression. You can always assume that the given expre 阅读全文
posted @ 2017-01-03 10:36 北叶青藤 阅读(220) 评论(0) 推荐(0)
摘要:The Hamming distance between two integers is the number of positions at which the corresponding bits are different. Now your job is to find the total 阅读全文
posted @ 2017-01-03 10:07 北叶青藤 阅读(284) 评论(0) 推荐(0)
摘要:Find the K closest points to a target point in a 2D plane. 阅读全文
posted @ 2017-01-01 04:16 北叶青藤 阅读(668) 评论(0) 推荐(0)
摘要:Given a complete binary tree, count the number of nodes. Definition of a complete binary tree from Wikipedia:In a complete binary tree every level, ex 阅读全文
posted @ 2016-12-31 00:35 北叶青藤 阅读(153) 评论(0) 推荐(0)
摘要:Given an array of integers, 1 ≤ a[i] ≤ n (n = size of array), some elements appear twice and others appear once. Find all the elements that appear twi 阅读全文
posted @ 2016-12-30 11:03 北叶青藤 阅读(178) 评论(0) 推荐(0)
摘要:Given an integer, write a function to determine if it is a power of three. Follow up:Could you do it without using any loop / recursion? 阅读全文
posted @ 2016-12-29 01:19 北叶青藤 阅读(155) 评论(0) 推荐(0)
摘要:Determine whether an integer is a palindrome. Do this without extra space. 分析:把一个数倒过来,然后看两个数是否相同。 Reverse digits of an integer. Example1: x = 123, ret 阅读全文
posted @ 2016-12-29 00:15 北叶青藤 阅读(235) 评论(0) 推荐(0)
摘要:Given two strings s and t, determine if they are isomorphic. Two strings are isomorphic if the characters in s can be replaced to get t. All occurrenc 阅读全文
posted @ 2016-12-27 04:30 北叶青藤 阅读(234) 评论(0) 推荐(0)
摘要:Question: For each word, you can get a list of neighbor words by calling getWords(String), find all the paths from word1 to word2. 阅读全文
posted @ 2016-12-24 12:49 北叶青藤 阅读(329) 评论(0) 推荐(0)
摘要:Given a binary tree, check whether it is a mirror of itself (ie, symmetric around its center). For example, this binary tree [1,2,2,3,4,4,3] is symmet 阅读全文
posted @ 2016-12-22 06:04 北叶青藤 阅读(157) 评论(0) 推荐(0)
摘要:Given a string of numbers and operators, return all possible results from computing all the different possible ways to group numbers and operators. Th 阅读全文
posted @ 2016-12-17 23:56 北叶青藤 阅读(203) 评论(0) 推荐(0)
摘要:Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: 阅读全文
posted @ 2016-12-13 14:58 北叶青藤 阅读(161) 评论(0) 推荐(0)
摘要:Given an array of meeting time intervals consisting of start and end times [[s1,e1],[s2,e2],...] (si < ei), determine if a person could attend all mee 阅读全文
posted @ 2016-12-01 05:55 北叶青藤 阅读(724) 评论(0) 推荐(0)
摘要:一个sequence,里面都是整数,求最长的subsequence的长度,使得这个subsquence的最大值和最小值相差不超过1. 比如[1,3,2,2,5,2,3,7]最长的subsequence是[3,2,2,2,3],所以应该返回5. 分析: 这题可以先排序,然后找出两个相差1的相邻值的最大 阅读全文
posted @ 2016-11-22 00:52 北叶青藤 阅读(382) 评论(0) 推荐(0)
摘要:Given a sorted array of integers nums and integer values a, b and c. Apply a function of the form f(x) = ax2 + bx + c to each element x in the array. 阅读全文
posted @ 2016-11-20 23:33 北叶青藤 阅读(279) 评论(0) 推荐(0)
摘要:An abbreviation of a word follows the form <first letter><number><last letter>. Below are some examples of word abbreviations: Assume you have a dicti 阅读全文
posted @ 2016-10-18 10:41 北叶青藤 阅读(206) 评论(0) 推荐(0)
摘要:An image is represented by a binary matrix with 0 as a white pixel and 1 as a black pixel. The black pixels are connected, i.e., there is only one bla 阅读全文
posted @ 2016-10-15 11:49 北叶青藤 阅读(210) 评论(0) 推荐(0)
摘要:Contains Duplicate I Given an array of integers, find if the array contains any duplicates. Your function should return true if any value appears at l 阅读全文
posted @ 2016-10-10 06:04 北叶青藤 阅读(256) 评论(0) 推荐(0)

上一页 1 ··· 3 4 5 6 7 8 9 10 11 12 下一页