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

 

zbaharav@kehillah.org > nestedLoopsArray
prev  |  next  |  chance

Given an array of non-negative integers, return a new array where each element of the original is repeated the appropriate number of times (as the number itself indicates).


nestedLoopsArray([1, 2, 3]) → [1, 2, 2, 3, 3, 3]
nestedLoopsArray([4]) → [4, 4, 4, 4]
nestedLoopsArray([0, 0]) → []

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

public int[] nestedLoopsArray(int[] a) { }

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: 210

Copyright Nick Parlante 2017 - privacy