摘要:
There are a row of n houses, each house can be painted with one of the k colors. The cost of painting each house with a certain color is different. Yo 阅读全文
posted @ 2015-12-23 13:31
neverlandly
阅读(993)
评论(0)
推荐(0)
摘要:
Given a string s, return all the palindromic permutations (without duplicates) of it. Return an empty list if no palindromic permutation could be form... 阅读全文
posted @ 2015-12-23 12:53
neverlandly
阅读(348)
评论(0)
推荐(0)
摘要:
Given a string, determine if a permutation of the string could form a palindrome.For example,"code" -> False, "aab" -> True, "carerac" -> True.Hint:Co... 阅读全文
posted @ 2015-12-23 11:32
neverlandly
阅读(235)
评论(0)
推荐(0)
摘要:
Write a program to check whether a given number is an ugly number. Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For exa 阅读全文
posted @ 2015-12-23 06:59
neverlandly
阅读(230)
评论(0)
推荐(0)
摘要:
Write a program to find the n-th ugly number.Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6... 阅读全文
posted @ 2015-12-23 06:48
neverlandly
阅读(277)
评论(0)
推荐(0)
摘要:
Lintcode 也有这道题 Single Number III example: 1 0 1 0 0 0 1 0 1 0 0 0 0 0 1 0 0 0 0 0 1 0 0 0 1 0 0 1 0 0 1 0 0 1 0 0 0 0 1 0 0 0 0 0 1 0 0 1 如例所示,最后两个数8, 阅读全文
posted @ 2015-12-23 05:43
neverlandly
阅读(232)
评论(0)
推荐(0)
摘要:
Given an array of n integers nums and a target, find the number of index triplets i, j, k with 0 =2; i--) { 6 //if (i!=nums.length-1 && (n... 阅读全文
posted @ 2015-12-23 04:47
neverlandly
阅读(322)
评论(0)
推荐(0)
摘要:
Numbers can be regarded as product of its factors. For example, 8 = 2 x 2 x 2; = 2 x 4. Write a function that takes an integer n and return all possib 阅读全文
posted @ 2015-12-23 02:33
neverlandly
阅读(475)
评论(0)
推荐(0)
摘要:
用到了Divide and Conquer, 跟 Leetcode: Unique Binary Search Trees II 很像 在input string里遍历各个operator, 依据每个operator分成左右子串,左右子串做递归返回所有可能的results,然后全排列。 注意很巧妙的 阅读全文
posted @ 2015-12-23 00:43
neverlandly
阅读(332)
评论(0)
推荐(0)
浙公网安备 33010602011771号