Write a function: def solution(A) that, given an array A of N integers, returns the smallest positive integer (greater than 0) that does not occur in ...
分类:
编程语言 时间:
2019-07-08 10:41:54
阅读次数:
338
Given a non-negative integer num represented as a string, remove k digits from the number so that the new number is the smallest possible. Note: The l ...
分类:
其他好文 时间:
2019-06-15 15:43:20
阅读次数:
104
题目如下: Return the lexicographically smallest subsequence of text that contains all the distinct characters of text exactly once. Example 1: Example 2: ...
分类:
其他好文 时间:
2019-06-15 10:09:22
阅读次数:
108
找到一个跟我的思路比较接近的参考解决方案: 参考:https://leetcode.com/problems/smallest-subsequence-of-distinct-characters/discuss/308222/show-my-thinking-process ...
分类:
其他好文 时间:
2019-06-09 22:25:27
阅读次数:
136
二分查找 区间长度为[mn, mx] 然后O(n) 求出 & v, int k) { int len = v.size(); if(k = k) ans = m, r = m 1; else l = m+1; } return ans; } int count(vector & v, int m) ...
分类:
其他好文 时间:
2019-06-08 15:06:03
阅读次数:
102
902. Kth Smallest Element in a BST https://www.lintcode.com/problem/kth-smallest-element-in-a-bst/description?_from=ladder&&fromId=1 578. Lowest Commo ...
分类:
其他好文 时间:
2019-05-25 09:20:14
阅读次数:
139
Alice has a magic array. She suggests that the value of a interval is equal to the sum of the values in the interval, multiplied by the smallest value ...
分类:
其他好文 时间:
2019-04-21 20:18:05
阅读次数:
152
思路显然是暴力枚举. 但是两个问题: 1.当1的位数非常大时,模运算很费时间,会超时. 其实每次不用完全用'11111...'来%K,上一次的余数*10+1后再%K就行. 证明: 令f(n)=111111...(n个1); g(n)=f(n)%K 因为f(n)=f(n-1)*10+1 所以f(n)% ...
分类:
其他好文 时间:
2019-04-12 23:07:43
阅读次数:
242
Problem 5 Problem 5 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest po ...
分类:
其他好文 时间:
2019-04-02 17:06:58
阅读次数:
104
Given a binary search tree, write a function kthSmallest to find the kth smallest element in it. Note: You may assume k is always valid, 1 ≤ k ≤ BST's ...
分类:
其他好文 时间:
2019-03-31 14:07:00
阅读次数:
132