Company: Oracle_23sep
Difficulty: medium
Valid keys Problem Description A cyber security firm has discovered a new type of encryption key being used by a group of hackers. The encryption key will be a valid key, which is a number that has exactly 3 factors (or divisors). For example, 4 is a valid key because it has exactly 3 factors: 1, 2, and 4. But 6 is not a valid key because it has 4 factors: 1, 2, 3, and 6. Given an array keys of length n , find the number of valid keys in the range [1, keys[i]] , both inclusive, for each 0 . Note: a is called a divisor of b if there is an integer c such that a * c = b. Only positive integers are taken into account for counting divisors. Complete the function getValidKeyCount in the editor below. The function getValidKeyCount has the following parameter: vector keys : an array of integers. Returns: vector : an array of integers containing the answer for each query. vector getValidKeyCount(vector keys) { // Function body to be implemented } Examples Example 1: Input: keys = [5, 11] Output