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 ...
You haveklists of sorted integers in ascending order. Find thesmallestrange that includes at least one number from each of theklists. We define the range a,b is smaller than range c,d ifb a lt d cora ...
2017-07-18 13:26 4 7059 推薦指數:
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 ...
Given an array `A` of integers, for each integer `A[i]` we need to choose either `x = -K` or `x = K`, and add `x` to `A[i] (only once)`. After ...
Given a positive integer K, you need to find the length of the smallest positive integer N such that N is divisible by K, and N only contains ...
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 ...
的表頭元素取出來,建立一個小頂堆,因為k個鏈表中都排好序了,因此每次取堆頂的元素就是k個鏈表中的最小值 ...
題目鏈接 Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity. 合並k個有序的鏈表,我們假設每個鏈表的平均長度是n。這一題需要用到合並兩個有序的鏈表子 ...
Given a non-empty array of integers, return the k most frequent elements. Example 1: Example 2: Note: You may assume k is always ...
Given a sorted array, two integers k and x, find the k closest elements to x in the array. The result should also be sorted in ascending order. ...