摘要: Given a string and an offset, rotate string by offset. (rotate from left to right)ExampleGiven "abcdefg"for offset=0, return "abcdefg"for offset=1, re... 阅读全文
posted @ 2014-12-25 09:52 LiBlog 阅读(345) 评论(0) 推荐(0) 编辑
摘要: Given an array of integers and a number k, find k non-overlapping subarrays which have the largest sum.The number in each subarray should be contiguou... 阅读全文
posted @ 2014-12-25 09:38 LiBlog 阅读(4338) 评论(2) 推荐(1) 编辑
摘要: Given an array of integers, find two non-overlapping subarrays which have the largest sum.The number in each subarray should be contiguous.Return the ... 阅读全文
posted @ 2014-12-25 08:22 LiBlog 阅读(1623) 评论(0) 推荐(0) 编辑
摘要: Design an algorithm to find the kth number such that the only prime factors are 3, 5, and 7. The eligible numbers are like 3, 5, 7, 9, 15 ... Example 阅读全文
posted @ 2014-12-25 07:52 LiBlog 阅读(407) 评论(0) 推荐(0) 编辑
摘要: 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 sm... 阅读全文
posted @ 2014-12-25 05:25 LiBlog 阅读(1686) 评论(0) 推荐(0) 编辑
摘要: Given a matrix of lower alphabetsand a dictionary.Find all words in the dictionary that can be found in the matrix. A word can start from any position... 阅读全文
posted @ 2014-12-25 04:41 LiBlog 阅读(496) 评论(0) 推荐(0) 编辑
摘要: Calculate the an% b where a, b and n are all 32bit integers.ExampleFor 231 % 3 = 2For 1001000 % 1000 = 0ChallengeO(logn)Solution: 1 class Solution { 2... 阅读全文
posted @ 2014-12-25 04:11 LiBlog 阅读(524) 评论(0) 推荐(0) 编辑
摘要: 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... 阅读全文
posted @ 2014-12-25 01:37 LiBlog 阅读(1971) 评论(0) 推荐(0) 编辑
摘要: Given a stringsand a dictionary of wordsdict, determine ifscan be segmented into a space-separated sequence of one or more dictionary words.ExampleGiv... 阅读全文
posted @ 2014-12-25 00:30 LiBlog 阅读(700) 评论(0) 推荐(0) 编辑