https://leetcode.com/problems/find-k-pairs-with-smallest-sums/discuss/84551/simple-Java-O(KlogK)-solution-with-explanation public class Solution { pub... ...
分类:
其他好文 时间:
2018-11-08 18:15:10
阅读次数:
135
You are given two integer arrays nums1 and nums2 sorted in ascending order and an integer k. Define a pair (u,v) which consists of one element from th... ...
分类:
其他好文 时间:
2018-11-06 11:22:59
阅读次数:
191
Given a n x n matrix where each of the rows and columns are sorted in ascending order, find the kth smallest element in the matrix. Note that it is th... ...
分类:
其他好文 时间:
2018-11-06 11:16:38
阅读次数:
156
Nearly every one have used the Multiplication Table. But could you find out the k-th smallest number quickly from the multiplication table? Given the ... ...
分类:
其他好文 时间:
2018-11-06 11:09:22
阅读次数:
109
题意:给定一个由a和b构成的字符串,可以选择翻转或不翻转他的每个前缀,翻转记为1不翻转记为0,求能将字符串排序的字典序最小的操作序列 n<=1e3 思路:考虑极长的一段a [t,w] 翻转t-1与w就能把这段a移到最前面 ...
分类:
其他好文 时间:
2018-10-29 19:59:39
阅读次数:
152
Calces系列相关文章: "Calces自动实现Android组件化模块构建" 前言 屏幕适配一直是移动端开发热议的问题,但是适配方案往往在实际开发的时候会和UI提供的设计稿冲突。本文主要是基于官方推荐的配置限定符方案(Smallest Width目前Android屏幕适配的最优方案)来实现一个接 ...
分类:
其他好文 时间:
2018-10-21 21:57:33
阅读次数:
264
Given an array A of integers, for each integer A[i] we may choose any x with K ...
分类:
其他好文 时间:
2018-10-21 13:06:02
阅读次数:
87
Given a list of sorted characters letterscontaining only lowercase letters, and given a target letter target, find the smallest element in the list th ...
分类:
其他好文 时间:
2018-10-18 01:17:00
阅读次数:
132
很有意思的一道数学推理题目, 剪枝以后解法也很简洁。初看貌似需要把每个数跟其他数作比较。但排序以后可以发现情况大大简化:对于任一对元素a[i] < a[j], a[i] - k和a[j] + k 的情况可以排除, 因为会产生比原值更大的差, 所以对于原有数组的最小值min最大值max, (min - ...
分类:
其他好文 时间:
2018-10-15 14:33:35
阅读次数:
191
Given an array A of integers, for each integer A[i] we may choose any x with -K <= x <= K, and add x to A[i]. After this process, we have some array B ...
分类:
其他好文 时间:
2018-10-07 13:51:19
阅读次数:
143