Company: Publicius_sapient_9nov
Difficulty: medium
Valid Key Count Problem Description A cyber security firm has discovered a new type of encryption used by a group of hackers. The encryption key will be a valid key, which is a number that has exactly 3 factors. For example, 4 is a valid key because it has exactly 3 factors: 1, 2, and 4. Six is not a valid key because it has 4 factors: 1, 2, 3, and 6. Given an array of keys of length n , find the number of valid keys in the range [1, key[i]] , both inclusive, for each 0 <= i < n . 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 is expected to return an INTEGER_ARRAY . The function accepts LONG_INTEGER_ARRAY keys as parameter. vector<int> getValidKeyCount(vector<long> keys) { // Function body to be implemented } Examples Example 1: Input: 2 5 11 Output: 1 2 Explanation: Given n = 2 , keys = [5, 11]