id/email
password
forgot password | create account
about | help | code help+videos | done | prefs
CodingBat code practice

 

frew@mclean.com heap-1 > sumNSmallList
prev  |  next  |  chance

Return the sum of the n smallest numbers in the list. The list will only contain unique values at will have at least n values.


sumNSmallList([2, 1, 3, 4], 3) → 6
sumNSmallList([2, 7, 0], 2) → 2
sumNSmallList([1, 3, 5], 3) → 9

...Save, Compile, Run (ctrl-enter)

public int sumNSmallList(ArrayList<Integer> nums, int n) { }

Editor font size %:
Shorter output


Forget It! -- delete my code for this problem

Progress graphs:
 Your progress graph for this problem
 Random user progress graph for this problem
 Random Epic Progress Graph

Java Help

Misc Code Practice

Difficulty: 200

Copyright Nick Parlante 2017 - privacy