随笔分类 - Lintcode
Lintcode: Hash Function && Summary: Modular Multiplication, Addition, Power && Summary: 长整形long
摘要:In data structure Hash, hash function is used to convert a string(or any other type) into an integer smaller than hash size and bigger or equal to zer...
阅读全文
Lintcode: Fizz Buzz
摘要:StringBuffer的用法,append方法的参数可以使boolean, char, char[], CharSequence, double, float, int, long, String, StringBuffer Better way: http://www.cnblogs.com/E
阅读全文
Lintcode: First Bad Version
摘要:The code base version is an integer and start from 1 to n. One day, someone commit a bad version in the code case, so it caused itself and the followi...
阅读全文
Lintcode: Find Peak Element
摘要:There is an integer array which has the following features: * The numbers in adjacent positions are different. * A[0] A[A.length - 1].We define...
阅读全文
Lintcode: Fast Power
摘要:Calculate the a^n % b where a, b and n are all 32bit integers.ExampleFor 2^31 % 3 = 2For 100^1000 % 1000 = 0ChallengeO(logn)这道题跟Pow这道题很像数学问题,要求O(log n...
阅读全文
Lintcode: Delete Digits
摘要:Given string A representative a positive integer which has N digits, remove any k digits of the number, the remaining digits are arranged according to...
阅读全文
Lintcode: Digit Counts
摘要:Count the number of k's between 0 and n. k can be 0 - 9.Exampleif n=12, in [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12], we have FIVE 1's (1, 10, 11, 12...
阅读全文
Lintcode: Compare Strings
摘要:Compare two strings A and B, determine whether A contains all of the characters in B.The characters in string A and B are all Upper Case letters.Examp...
阅读全文
Lintcode: First Position of Target (Binary Search)
摘要:Binary search is a famous question in algorithm.For a given sorted array (ascending order) and a target number, find the first index of this number in...
阅读全文
Lintcode: Binary Representation
摘要:Given a (decimal - e g 3.72) number that is passed in as a string,return the binary representation that is passed in as a string.If the number can no...
阅读全文
Lintcode: Backpack II
摘要:Given n items with size A[i] and value V[i], and a backpack with size m. What's the maximum value can you put into the backpack?NoteYou cannot divide ...
阅读全文
Lintcode: Backpack
摘要:Given n items with size A[i], an integer m denotes the size of a backpack. How full you can fill this backpack? NoteYou can not divide any item into s...
阅读全文
Lintcode: A+B problem
摘要:For given numbers a and b in function aplusb, return the sum of them.NoteYou don't need to parse the input and output. Just calculate and return.Examp...
阅读全文
浙公网安备 33010602011771号