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

 

skipN


Return an int[] of length n where n / m elements are set to their index when m divides the index with no remainder and the remaining elements are set to zero.


skipN(10, 4) → [0, 0, 0, 0, 4, 0, 0, 0, 8, 0]
skipN(20, 4) → [0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 12, 0, 0, 0, 16, 0, 0, 0]
skipN(30, 4) → [0, 0, 0, 0, 4, 0, 0, 0, 8, 0, 0, 0, 12, 0, 0, 0, 16, 0, 0, 0, 20, 0, 0, 0, 24, 0, 0, 0, 28, 0]

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

public int[] skipN(int n, int m) { }

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

Copyright Nick Parlante 2017 - privacy