題目:給你一個數字n,將裡面每位的數重新組合形成a,b,使得a-b最大且是9的倍數。
分析:數論。題目要求a,b和n的位數相同,不能有前導0。
定理1:交換一個數字中的某兩個位的數,形成的新數組和原數字之差是9的倍數;
證明1:設數字為abc..i..j...xwz,其中每个字母代表一个位,对应值可以相同,...
分类:
其他好文 时间:
2015-07-08 22:39:58
阅读次数:
196
1 class Solution { 2 public: 3 vector> combinationSum(vector& candidates, int target) { 4 int size=candidates.size(); 5 vector> c...
分类:
其他好文 时间:
2015-07-08 20:42:46
阅读次数:
109
This is the first tiny part of reading notes about Acoustic Theory of Speech Production....
分类:
其他好文 时间:
2015-07-08 18:55:39
阅读次数:
161
1 import java.util.ArrayList; 2 import java.util.Arrays; 3 4 5 public class Combination { 6 7 public static ArrayList> combine(int n, int ...
分类:
系统相关 时间:
2015-07-08 12:49:58
阅读次数:
157
Combination Sum IIIFind all possible combinations ofknumbers that add up to a numbern, given that only numbers from 1 to 9 can be used and each combin...
分类:
其他好文 时间:
2015-07-07 19:12:51
阅读次数:
105
题目:Given two integersnandk, return all possible combinations ofknumbers out of 1 ...n.For example,Ifn= 4 andk= 2, a solution is:[ [2,4], [3,4], [2,...
分类:
其他好文 时间:
2015-07-07 18:42:12
阅读次数:
101
Find all possible combinations of k numbers that add up to a number n, given that only numbers
from 1 to 9 can be used and each combination should be a unique set of numbers.
Ensure that numbers wi...
分类:
其他好文 时间:
2015-07-07 11:07:18
阅读次数:
94
Given a set of candidate numbers (C) and a target number (T), find all unique combinations in C where the candidate numbers sums to T.The same repeated number may be chosen from C unlimited number of t...
分类:
其他好文 时间:
2015-07-06 21:45:12
阅读次数:
107
暴力搜索 无压力, 只是要注意Line 14作用 如果用deepcopy则耗时多了好多 1 class Solution: 2 def __init__(self): 3 self.ans = [] 4 # @param {integer} k 5 # @pa...
分类:
其他好文 时间:
2015-07-04 13:55:41
阅读次数:
159
Source:https://github.com/getify/You-Dont-Know-JS/blob/master/scope%20&%20closures/ch1.mdCommon Compliation StepsTokenizing/Lexing:breaking up a strin...
分类:
编程语言 时间:
2015-07-02 11:46:57
阅读次数:
174