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

 

Array-1 > makeLast
prev  |  next  |  chance

Given an int array, return a new array with double the length where its last element is the same as the original array, and all the other elements are 0. The original array will be length 1 or more. Note: by default, a new int array contains all 0's.


makeLast([4, 5, 6]) → [0, 0, 0, 0, 0, 6]
makeLast([1, 2]) → [0, 0, 0, 2]
makeLast([3]) → [0, 3]

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

public int[] makeLast(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: 142.0 Post-solution available

Copyright Nick Parlante 2017 - privacy