Skip to content

Latest commit

 

History

History
15 lines (11 loc) · 321 Bytes

README.md

File metadata and controls

15 lines (11 loc) · 321 Bytes

Find K smallest elements in an array

Description

Given an array and a number k where k is smaller than size of array, we need to find the k smallest elements in the given array. It is given that all array elements are distinct.

Examples

Input:  
  arr = [7, 10, 4, 3, 20, 15]
  k = 2
  Output: [3, 4]