Given N integers, you are supposed to find the smallest positive integer that is NOT in the given list. Input Specification: Each input file contains ...
分类:
其他好文 时间:
2018-06-14 20:57:53
阅读次数:
170
question: Modify binary search so that it always returns the element with the smallest index that mathes the search element (and still guarantees loga ...
分类:
其他好文 时间:
2018-06-03 14:31:23
阅读次数:
132
问题描述: Given an unsorted integer array, find the smallest missing positive integer. Example 1: Example 2: Example 3: Note: Your algorithm should run in ...
分类:
其他好文 时间:
2018-06-02 12:58:11
阅读次数:
165
爆搜解法: 一开始老是超时,用的手动搜索全排列,结果看一下题解,结果全部用的是next_permutation这个函数,就是用来做全排列的,改了一下,竟然过了,不得不说库函数还是蛮强的,推测一下它应该用的应该不是深搜实现的,不然应该不会这么快。(好想知道它用的什么算法呀!) 这个函数在algorit ...
分类:
其他好文 时间:
2018-05-28 21:18:49
阅读次数:
157
1038 Recover the Smallest Number (30)(30 分) Given a collection of number segments, you are supposed to recover the smallest number from them. For exam ...
分类:
其他好文 时间:
2018-05-27 16:47:48
阅读次数:
167
题目链接: https://www.luogu.org/problemnew/show/UVA11536 题目大意: 给定一个$N,M,K$,构造这样的数列: $x[1]=1,x[2]=2,x[3]=3$ $x[i]=(x[i 1]+x[i 2]+x[i 3])\mod M+1(N =i =4)$ ...
分类:
其他好文 时间:
2018-05-26 23:26:46
阅读次数:
395
传送门 题目 You are given a string s. Among the different substrings of s, print the K-th lexicographically smallest one. A substring of s is a string obta ...
分类:
其他好文 时间:
2018-05-21 19:49:35
阅读次数:
167
那么这道题给的提示是让我们用BST的性质来解题,最重要的性质是就是左<根<右,那么如果用中序遍历所有的节点就会得到一个有序数组。所以解题的关键还是中序遍历啊。 ...
分类:
其他好文 时间:
2018-05-21 14:38:58
阅读次数:
176
Smallest Number (medium): 求1-N的LCM,多组数据。 Divisors of factorial (hard) 求N的阶乘的因子个数。 ...
分类:
其他好文 时间:
2018-05-21 14:35:03
阅读次数:
122
41. First Missing Positive Given an unsorted integer array, find the smallest missing positive integer. Example 1: Example 2: Example 3: Note: Your al ...
分类:
其他好文 时间:
2018-05-20 15:19:29
阅读次数:
180