om-ganesh / codekata

1 stars 0 forks source link

Find count to repeat digit to make equal to count of max occuring digit #63

Open om-ganesh opened 3 years ago

om-ganesh commented 3 years ago

Given an integer array, find the number of times a particular digit should be repeated to make its count equal to the count of the integer which is occurring max times. Input: [1,2,2,3,2,2,3] Output: {1:3,3:2} Explanation: Here digit 2 is repeated max times i.e. 4. For other digit 1 so, we need to add 3 times to make equal to 4 so => <1,3> For other digit 3, we need to add it 2 times to make equal to 4 so => <3,2> Hence final answer is list of these tuples

om-ganesh commented 3 years ago

Discussion 2020-12-22 image