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

 

resize


Given an array of integers, resize the array to the specified size. If the new size is smaller than the original size truncate the array. If the new size is greater than the original side, pad the end of the array with the value -1. The specified size will be non-negative.


resize([3, 4, 5], 7) → [3, 4, 5, -1, -1, -1, -1]
resize([3, 4, 5], 2) → [3, 4]
resize([8, 6, 7, 5, 3, 0, 9], 1) → [8]

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

int[] resize(int[] nums, int size) { }

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