Company: Hsbc
Difficulty: easy
Greatest Number at Least K Times the Others You are given an array A of numbers of size N . Your task is to determine whether the maximum value of the array is at least K times every other number in the array. If the above condition is fulfilled, then print the index of the maximum number; otherwise, print -1 as output. Note: Indexing starts from 0 . The largest element in the array is unique. Input Format The input consists of two lines: The first line contains two integers N and K . The second line contains N space-separated integers denoting the elements of the array A . Input will be read from the STDIN by the candidate. Output Format If there exists a maximum number that satisfies the given condition then print the index of that number, otherwise print -1 . Output will be matched to the candidate's output printed on the STDOUT. Constraints 1 <= N <= 20000 (inferred — the original screenshot states 1 <= N <= 10^6 , but an array of 10^6 six-digit values does not fit insi