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

 

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

Write a method that accepts an array of integers and returns an array containing the same integers, but grouped by least-significant digit. The grouping must be in order from 0 to 9 of the least-significant digit, but within the group the order of the numbers has not been changed. For example, the array {53,72,18,12,42,83,91,78} becomes {91, 72, 12, 42, 53, 83, 18, 78}. Look at the test data for additional examples. This is easier than it sounds... especially if you don't try to make it super-efficient.


jan30_2020_HL_groupBy([7, 5, 3, 2]) → [2, 3, 5, 7]
jan30_2020_HL_groupBy([5312, 436, 124, 543615, 346, 62436, 8643, 398, 52398, 523, 64]) → [5312, 8643, 523, 124, 64, 543615, 436, 346, 62436, 398, 52398]
jan30_2020_HL_groupBy([142, 436, 9814, 432, 634, 42198, 364, 32, 5437, 53298]) → [142, 432, 32, 9814, 634, 364, 436, 5437, 42198, 53298]

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

public int[] jan30_2020_HL_groupBy(int nums[]) { }

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