Given an Array of integers, write a method that will return the integer with the maximum number of repetitions. Your code is expected to run with **O(n)** time complexity and **O(1)** space complexity.
The elements in the array are between **0** to **size(array) - 1** and the array will not be empty.

`f({3,1,2,2,3,4,4,4}) --> 4`

Need a **hand?** Try out these hints, one at a time.

Try and use the problem's constraints to your advantage. Numbers stored in the array are constrained by the length of the array.

1. Iterate through the input array `a`

. For every element `a[i]`

,
increment `a[a[i]%k]`

by `k`

, where the array contains numbers in range of `k-1`

.

2. Find the max value in the modified array. Index of the maximum element is the biggest repeating element

public static int getMaxRepetition(int[] a) { }

**C**

**Java**

**Python**