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

 

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

Given a non-decreasing array of integers 'nums', return an array that lists all the frequencies of duplicates in the 'nums' array in the same order in which they occur. For example, if the first number in 'nums' to be repeated is '231' and it occurs a total of 5 times, then the first number in the resulting array will be a '5'. If the next number to be repeated is '567' and it occurs a total of 2 times, the second number in the resulting array will be a '2'. This list of duplicate frequencies that gets returned must be in the same order in which the duplicates occur. The length of this resulting array depends on how many sets of duplicates were discovered. Look at the test data for examples.


test2024_01_22_HL_countDuplicates([7, 8, 12, 14]) → []
test2024_01_22_HL_countDuplicates([1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12, 15, 17, 22, 25]) → [96]
test2024_01_22_HL_countDuplicates([]) → []

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

public int[] test2024_01_22_HL_countDuplicates(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: 260

Copyright Nick Parlante 2017 - privacy