Skip to content

Latest commit

 

History

History

challenge-13

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 

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]