随笔分类 - Level 2
摘要:Construct minimum number by reordering a given non-negative integer array. Arrange them such that they form the minimum number. Notice The result may
阅读全文
摘要:According to the Wikipedia's article: "The Game of Life, also known simply as Life, is a cellular automaton devised by the British mathematician John
阅读全文
摘要:Given two strings S and T, determine if they are both one edit distance apart. 分析:https://segmentfault.com/a/1190000003906621 虽然我们可以用Edit Distance的解法,
阅读全文
摘要:Given an Iterator class interface with methods: next() and hasNext(), design and implement a PeekingIterator that support the peek()operation -- it es
阅读全文
摘要:Given two 1d vectors, implement an iterator to return their elements alternately. For example, given two 1d vectors: By calling next repeatedly until
阅读全文
摘要:Given an array of words and a length L, format the text such that each line has exactly L characters and is fully (left and right) justified. You shou
阅读全文
摘要:H-Index I Given an array of citations (each citation is a non-negative integer) of a researcher, write a function to compute the researcher's h-index.
阅读全文
摘要:Given a string S, you are allowed to convert it to a palindrome by adding characters in front of it. Find and return the shortest palindrome you can f
阅读全文
摘要:Implement an iterator to flatten a 2d vector. For example, Given 2d vector = By calling next repeatedly until hasNext returns false, the order of elem
阅读全文
摘要:Verify Preorder Sequence in Binary Search Tree \Given an array of numbers, verify whether it is the correct preorder traversal sequence of a binary se
阅读全文
摘要:A group of two or more people wants to meet and minimize the total travel distance. You are given a 2D grid of values 0 or 1, where each 1 marks the h
阅读全文
摘要:Given a binary tree, find the length of the longest consecutive sequence path (连续的路径,不是从小到大). The path refers to any sequence of nodes from some start
阅读全文
摘要:Additive number is a string whose digits can form additive sequence. A valid additive sequence should contain at least three numbers. Except for the f
阅读全文
摘要:Given a binary tree, return the vertical order traversal of its nodes' values. (ie, from top to bottom, column by column). If two nodes are in the sam
阅读全文
摘要:Given a string array words, find the maximum value of length(word[i]) * length(word[j]) where the two words do not share common letters. You may assum
阅读全文
摘要:Given a range [m, n] where 0 <= m <= n <= 2147483647, return the bitwise AND of all numbers in this range, inclusive. For example, given the range [5,
阅读全文
摘要:Given a binary tree, imagine yourself standing on the right side of it, return the values of the nodes you can see ordered from top to bottom. For exa
阅读全文
摘要:Given a string, find the longest substring that contains only two unique characters. For example, given "abcbbbbcccbdddadacb", the longest substring t
阅读全文
摘要:There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every
阅读全文
摘要:Given a set of distinct positive integers, find the largest subset such that every pair (Si, Sj) of elements in this subset satisfies: Si % Sj = 0 or
阅读全文

浙公网安备 33010602011771号