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

 

crehwinkel@frhsd.com > noLeadingZeros
prev  |  next  |  chance

Write a method noLeadingZeros which is passed an array of integers and which returns a new array that is a copy of the array passed to the method without any leading zeros. For example if the array {0,0,0,5,3,9,0,2} was passed to the method, the array {5, 3, 9, 0, 2} would be returned. If an empty array is passed to the method, it should return an empty array.


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

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

public int[] noLeadingZeros(int [] arr){ }

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