Skip to content

Latest commit

 

History

History

316-minSubs

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

minSubs

Interview question of the issue #316 of rendezvous with cassidoo.

The Question

Given an array of integers and a number k (where k is guaranteed to be less than the array's length), return a subarray of length k with the minimum possible sum. Maintain the order of the original array!

Example:

> minSubs([1,3,20,4,8,9,11], 3)
> [4,8,9]

> minSubs([4,4,4,4,8], 2)
> [4,4]

Installing & Running

Just pnpm i to install all dependencies and then pnpm t to run the tests!