发布了文章2016-08-11
题目:Given two words (beginWord and endWord), and a dictionary's word list, find all shortest transformation sequence(s) from beginWord to endWord, such that:
发布了文章2016-08-09
Matrix中的path问题:62.Unique Paths63.Unique Paths II这两题是典型的dp问题,要求一共有多少种方案。分析状态f(i, j)是走到(i, j)总共的路径。它可以由前面两个状态得到,即f(i, j)=f(i - 1, j) + f(i, j - 1)。最后注意边界值即可。变形是有设obstacle, 那么遇到...
发布了文章2016-08-04
题目:Given a data stream input of non-negative integers a1, a2, ..., an, ..., summarize the numbers seen so far as a list of disjoint intervals.
发布了文章2016-08-03
题目:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist. Assume that there is only one duplicate number, find the duplicate one.
发布了文章2016-08-02
题目: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 black region. Pixels are connected horizontally and vertically. Given the location (x, y) of o...
发布了文章2016-08-02
题目:Given an array of integers, find out whether there are two distinct indices i and j in the array such that the difference between nums[i] and nums[j] is at most t and the difference between i and j is at most k.
发布了文章2016-07-31
题目:Given two words (beginWord and endWord), and a dictionary's word list, find the length of shortest transformation sequence from beginWord to endWord, such that:
发布了文章2016-07-28
For example,path = "/home/", => "/home"path = "/a/./b/../../c/", => "/c"click to show corner cases.
发布了文章2016-07-28
题目:Given a 2D board and a list of words from the dictionary, find all words in the board.
发布了文章2016-07-26
题目:Additive number is a string whose digits can form additive sequence.
发布了文章2016-07-25
题目:Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 0 instead.
赞了文章2016-07-25
最近正在面试uber,uber以频繁考察系统设计而著名,系统设计是一个没有标准答案的open-end问题,所以关键在于对于特定问题的设计选择,俗称trade-off,这个思维平时无处锻炼,故开启此文,记录学习和理解的过程。 本文全部题目和分析来自《Elements Of Programming In...
发布了文章2016-07-20
题目:Given a linked list, return the node where the cycle begins. If there is no cycle, return null.
发布了文章2016-07-19
题目: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.
发布了文章2016-07-18
题目:Suppose you are at a party with n people (labeled from 0 to n - 1) and among them, there may exist one celebrity. The definition of a celebrity is that all the other n - 1 people know him/her but he/she does not know any of them.
发布了文章2016-07-18
问题: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 Horton Conway in 1970."
发布了文章2016-07-18
246.Strobogrammatic NumberI题目:A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down).
赞了文章2016-07-17
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. The returned array must be in sorted order. Expected time complexity: O(n) Example:nums = [-4, -2...
发布了文章2016-07-15
题目: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.
发布了文章2016-07-15
题目:Given an array containing n distinct numbers taken from 0, 1, 2, ..., n, find the one that is missing from the array.