原题 题目链接 题目分析 题目要求将一组数组成两个数,注意不能有前导零,要求差绝对值最小, 所以要取两个位数最接近的数来做差,然后搜就完事了.搜法可以用全排列搜,由于只取两个数,就可以直接取前half个数作为一个数,剩下的作为一个数,做差就行了,这样全排列刚好能遍历所有情况. 代码 ...
分类:
其他好文 时间:
2019-08-22 22:21:01
阅读次数:
127
Given an array of integers, for each integer we need to choose?either or , and add to . After this process, we have some array . Return the smallest p ...
分类:
其他好文 时间:
2019-08-16 01:04:06
阅读次数:
106
题目链接:http://acm.hdu.edu.cn/showproblem.php?pid=6625 题意: 给你两串数 a串,b串,让你一一配对XOR使得新的 C 串字典序最小。 思路: 首先这边有两个问题: 1. 我要怎么知道这两个数配对是最优的:一开始我也不明白(以为选择会有后效性),其实很 ...
分类:
其他好文 时间:
2019-08-13 22:48:10
阅读次数:
91
返回排序二叉树第K小的数 还是用先序遍历,记录index和K进行比较 程序运行动态演示 http://simpledsp.com/FS/Html/lc230.html ...
分类:
其他好文 时间:
2019-08-13 09:13:09
阅读次数:
76
The Company Dynamic Rankings has developed a new kind of computer that is no longer satisfied with the query like to simply find the k-th smallest num ...
分类:
编程语言 时间:
2019-08-09 01:38:56
阅读次数:
157
1144 The Missing Number (20 分) 1144 The Missing Number (20 分) 1144 The Missing Number (20 分) Given N integers, you are supposed to find the smallest p ...
分类:
其他好文 时间:
2019-07-31 14:48:26
阅读次数:
78
https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Medium https://leetcode.com/problems/kth-smallest-element-in-a-bst/ Medium https://leetco ...
分类:
其他好文 时间:
2019-07-29 20:15:18
阅读次数:
104
An ascending sorted sequence of distinct values is one in which some form of a less-than operator is used to order the elements from smallest to large ...
分类:
编程语言 时间:
2019-07-28 22:44:35
阅读次数:
140
-->Smallest Difference 直接写中文了 Descriptions: 给定若干位十进制数,你可以通过选择一个非空子集并以某种顺序构建一个数。剩余元素可以用相同规则构建第二个数。除非构造的数恰好为0,否则不能以0打头。 举例来说,给定数字0,1,2,4,6与7,你可以写出10和246 ...
分类:
其他好文 时间:
2019-07-15 21:14:58
阅读次数:
126