Algorithms: K times

Company: Ernst & Young-Java Backend_22may

Difficulty: medium

Problem Statement

You are given an array, A , consisting of N elements. Find the highest number from the array that has been repeated exactly K times in the array. Note There will be at least one variable that is repeated K times. Function Description In the provided code snippet, implement the provided kTimes(...) method to find the highest number from the array that has been repeated exactly K times in the array. You can write your code in the space below the phrase "WRITE YOUR LOGIC HERE" . There will be multiple test cases running, so the Input and Output should match exactly as provided. The base output variable result is set to a default value of -404 which can be modified. Additionally, you can add or remove these output variables. Input Format The first line contains a single integer N , denoting the size of the array A . The second line contains N space-separated integers, denoting the elements of array A . The third contains a single integer, denoting K . Constraints 1 < N < 10 3 1 ≤