随笔分类 - Cracking the Coding Interview
摘要:You are given a binary tree in which each node contains a value. Design an algorithm to print all paths which sum up to that value. Note that it can b...
阅读全文
摘要:Design an algorithm to find the kth number such that the only prime factors are 3,5 and 7方法一:a[i]=min{a[s1]*3,a[s2]*5,a[s3]*7};s1a[i-1],a[s2]*3>a[i-1]...
阅读全文
摘要:Given a infinite number of quarters(25cents), dimens(10cents), nickels(5cents) and pennies(1cent), write code to calculate the number of ways of repre...
阅读全文
摘要:Implement an algorithm to print all valid combinations of n-pairs of parentheses#includevoid f(int idx,int left,int right,char *buf){ if(left == 0 ...
阅读全文
摘要:There is a building of 100 floors. If an egg drops from the Nth floor or above, it will break. If it's dropped from any floor below, it will not break...
阅读全文
摘要:There is an 8*8 chess board in which two diagnolly opposite corners have been cut off. You are given 31 dominos, and a single domino can cover exactly...
阅读全文
摘要:Given a(decimal -e.g. 3.72)number that is passed in as a string, print the binary representation. If the number can not be represented accurately in b...
阅读全文
摘要:An array A[1...n] contains all the integers from 0 to n except for one number which is missing.In this problem, we cannot access an entire integer in ...
阅读全文

浙公网安备 33010602011771号