摘要:
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文
摘要:
Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 6 7 might become 4 5 6 7 0 1 2). Find the minimum element. 阅读全文
摘要:
Calculate the a^n % b where a, b and n are all 32bit integers. For 2^31 % 3 = 2 For 100^1000 % 1000 = 0 这道题有个值得注意的问题,当n为奇数的时候,如果把递归写成: long num = fast 阅读全文
摘要:
Evaluate the value of an arithmetic expression inReverse Polish Notation. Valid operators are +, -, *, /. Each operand may be an integer or another ex 阅读全文
摘要:
Given two words word1 and word2, find the minimum number of steps required to convert word1 to word2. (each operation is counted as 1 step.) You have 阅读全文
摘要:
Divide two integers without using multiplication, division and mod operator. If it is overflow, return 2147483647 Given dividend = 100 and divisor = 9 阅读全文
摘要:
Given a string S and a string T, count the number of distinct subsequences of T in S. A subsequence of a string is a new string which is formed from t 阅读全文