原创 Lintcode24 LFU Cache solution 題解

【題目描述】LFU (Least Frequently Used) is a famous cache eviction algorithm.For a cache with capacity k, if the cache is full

原创 Lintcode12 Min Stack solution 題解

題目描述】Implement a stack with min() function, which will return the smallest number in the stack.It should support push, p

原创 Lintcode9 Fizz Buzz solution 題解

【題目描述】Given number n. Print number from 1 to n. But:when number is divided by 3, print "fizz".when number is divided by

原创 Lintcode13 strStr solution 題解

【題目描述】For a given source string and a target string, you should output the first index(from 0) of target string in sourc

原创 Lintcode11 Search Range in Binary Search Tree solution 題解

【題目描述】Given two values k1 and k2 (where k1 < k2) and a root pointer to a Binary Search Tree. Find all the keys of tree i

原创 Lintcode8 Rotate String solution 題解

【題目描述】Given a string and an offset, rotate string by offset. (rotate from left to right)給定一個字符串和一個偏移量,根據偏移量旋轉字符串(從左向右旋轉)

原创 Lintcode7 Binary Tree Serialization solution 題解

【題目描述】Design an algorithm and write code to serialize and deserialize a binary tree. Writing the tree to a file is calle

原创 Lintcode5 Kth Largest Element solution 題解

【題目描述】Find K-th largest element in an array.Notice:You can swap elements in the array在數組中找到第k大的元素注意:你可以交換數組中的元素的位置【題目鏈接】

原创 Lintcode6 Merge Two Sorted Arrays solution 題解

【題目描述】Merge two given sorted integer array A and B into a new sorted integer array.合併兩個排序的整數數組A和B變成一個新的數組。【題目鏈接】http://w