about | help | code help+videos | done | prefs |
Write a method that returns the integer array that is passed in, except that every-other number has been replaced with a zero. So keep the first number, then replace the next one with zero, and keep alternating like that. There can be any number of numbers in the array. Look at the test data for examples. sept26_2019_P1SLHL_replaceEveryOther([5, 17, -3, 18, 22, -64, -5]) → [5, 0, -3, 0, 22, 0, -5] sept26_2019_P1SLHL_replaceEveryOther([4]) → [4] sept26_2019_P1SLHL_replaceEveryOther([4, 2]) → [4, 0] ...Save, Compile, Run (ctrl-enter) |
Progress graphs:
Your progress graph for this problem
Random user progress graph for this problem
Random Epic Progress Graph
Difficulty: 290
Copyright Nick Parlante 2017 - privacy