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

 

jebbert@volusia.k12.fl.us > mar5_2020_HL_placeIfMultiple
prev  |  next  |  chance

Write a method that accepts an array of positive integers calls 'nums' and a multiple called 'mult'. Return a new array with all of the multiples of 'mult' in 'nums' at the start of the array in the same order as they were in 'nums'. The end of the new array will have the numbers that are NOT multiples of 'mult' but in the reverse order compared to the original array. Look at the test data for examples. This is easier than it sounds and can be done using only one loop!


mar5_2020_HL_placeIfMultiple([6], 5) → [6]
mar5_2020_HL_placeIfMultiple([83], 83) → [83]
mar5_2020_HL_placeIfMultiple([17, 22, 45], 11) → [22, 45, 17]

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

public int[] mar5_2020_HL_placeIfMultiple(int[] nums, int mult) { }

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

Copyright Nick Parlante 2017 - privacy