11 2014 档案
摘要:Problem StatementGiven two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1...
阅读全文
摘要:Problem Statement描述 一日,崔克茜来到小马镇表演魔法。其中有一个节目是开锁咒:舞台上有 n 个盒子,每个盒子中有一把钥匙,对于每个盒子而言有且仅有一把钥匙能打开它。初始时,崔克茜将会随机地选择 k 个盒子用魔法将它们打开。崔克茜想知道最后所有盒子都被打开的概率,你能帮助她回答这个问...
阅读全文
摘要:Problem StatementGiven a string s, partition s such that every substring of the partition is a palindrome.Return the minimum cuts needed for a palindr...
阅读全文
摘要:My naive running time solution:class Solution {public: int jump(int A[], int n) { if(1 == n) return 0; int maxL = (1= (i-j) ...
阅读全文
摘要:Problem StatementGiven an unsorted array of integers, find the length of the longest consecutive elements sequence.For example, Given [100, 4, 200, 1,...
阅读全文
摘要:Loop List is very common in interview. This article we give a more strict shortstatement about its solving.One method to check if there's a loop in a ...
阅读全文
摘要:A fast method to determine the number is odd or even:total & 0x1 //true, if total is oddtotal & 0x1 //false, if total is evenProblem StatementThere ar...
阅读全文
摘要:Let'sbegin witha naive method.We first need to sort the array A[n]. And we want to solve the problem by iterating through A from beginning and ending....
阅读全文
摘要:Problem StatementImplement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers.If such arrangeme...
阅读全文
摘要:The maximum product of sub-arrays in can be divided by 3 cases:A[n] is the maximum product of all sub-arrays in [1, n].The array which has th...
阅读全文