axman6
searching PlanetScale…
- 1.▲
- 2.▲
- 3.▲
- 4.▲
- 5.▲
- 6.▲
34 ms·
- 301.▲
Doesn't this only work if the elements are unique? say you wanted the top three from [1,2,3,2,3,3,4,3,3,3,3,4,3], then the kth largest element would be 3, and we'd end up outputting [3,3,3,4,3,3,3,3,4,3], which is obviously not k elements. - 302.▲
- 303.▲
- 304.▲
- 305.▲
- 306.▲
- 307.▲
- 308.▲
- 309.▲
- 310.▲
- 311.▲
- 312.▲
- 313.▲