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

 

andersoniii.edwin@cusd80.com > surroundMe
prev  |  next  |  chance

SurroundMe - Given an array of integers- return a new array where every integer in the given array is surrounded by zeros. [1,2] becomes [0,1,0,2,0]. If the given array is empty then return an empty array.


surroundMe([1, 2]) → [0, 1, 0, 2, 0]
surroundMe([1]) → [0, 1, 0]
surroundMe([9, 8, 7, 6, 5, 4]) → [0, 9, 0, 8, 0, 7, 0, 6, 0, 5, 0, 4, 0]

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

public int[] surroundMe(int[] nums){ }

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

Copyright Nick Parlante 2017 - privacy