随笔分类 -  Level 2

上一页 1 ··· 8 9 10 11 12
摘要:Implement a function to check if a linked list is a palindrome. Implement a function to check if a linked list is a palindrome. Implement a function t 阅读全文
posted @ 2016-07-02 13:08 北叶青藤 阅读(200) 评论(0) 推荐(0)
摘要:Given a linked list and two values v1 and v2. Swap the two nodes in the linked list with values v1 and v2. It's guaranteed there is no duplicate value 阅读全文
posted @ 2016-07-02 11:06 北叶青藤 阅读(226) 评论(0) 推荐(0)
摘要:Find the contiguous subarray within an array (containing at least one number) which has the largest product. Example For example, given the array [2,3 阅读全文
posted @ 2016-07-01 05:44 北叶青藤 阅读(201) 评论(0) 推荐(0)
摘要:Given an array of n positive integers and a positive integer s, find the minimal length of a subarray of which the sum ≥ s. If there isn't one, return 阅读全文
posted @ 2016-07-01 05:23 北叶青藤 阅读(150) 评论(0) 推荐(0)
摘要:Given an array with positive and negative integers. Re-range it to interleaving with positive and negative integers. Note: You are not necessary to ke 阅读全文
posted @ 2016-06-30 05:12 北叶青藤 阅读(301) 评论(0) 推荐(0)
摘要:Majority Number Given an array of integers, the majority number is the number that occurs more than half of the size of the array. Find it. Example Gi 阅读全文
posted @ 2016-06-29 22:58 北叶青藤 阅读(395) 评论(0) 推荐(0)
摘要:Question: Find the longest sub-string without repeating characters. For example, if the given string is "abcdcefg", the longest sub-string is "dcefg". 阅读全文
posted @ 2015-01-26 05:50 北叶青藤 阅读(202) 评论(0) 推荐(0)
摘要:Given a string, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. For example,"A man, a plan, a canal: Pan 阅读全文
posted @ 2015-01-10 08:35 北叶青藤 阅读(158) 评论(0) 推荐(0)
摘要:The count-and-say sequence is the sequence of integers beginning as follows:1, 11, 21, 1211, 111221, ... 1 is read off as "one 1" or 11.11 is read off 阅读全文
posted @ 2015-01-10 08:31 北叶青藤 阅读(131) 评论(0) 推荐(0)
摘要:问题:产生n位元的所有格雷码。 格雷码(Gray Code)是一个数列集合,每个数使用二进位来表示,假设使用n位元来表示每个数字,任两个数之间只有一个位元值不同。 例如以下为3位元的格雷码: 000 001 011 010 110 111 101 100 。 如果要产生n位元的格雷码,那么格雷码的个 阅读全文
posted @ 2015-01-06 09:01 北叶青藤 阅读(307) 评论(0) 推荐(0)
摘要:Given two integers n and k, return all possible combinations of k numbers out of 1 ... n. For example,If n = 4 and k = 2, a solution is: 转载请注明出处: cnbl 阅读全文
posted @ 2015-01-06 08:53 北叶青藤 阅读(188) 评论(0) 推荐(0)
摘要:问题:给一个字符串,比如ABC, 把所有的排列,即:ABC, ACB, BAC, BCA, CAB, CBC 都找出来。 解题思路:对于一个n 位的字符串来讲,它是n-1位字符串的排列 加上 没有在 n -1 位字符串里 那个字符 的排列。 有点难理解,用例子说明:对于字符串ABC来讲,它所有的排列 阅读全文
posted @ 2015-01-01 08:33 北叶青藤 阅读(368) 评论(0) 推荐(0)

上一页 1 ··· 8 9 10 11 12