Company: GoComet_11march
Difficulty: medium
Potential Attack Vector Design an algorithm to detect potential attack vectors within a network. An attack vector in an array of keys is defined as a trio of indices (i, j, x) where keys[i] and keys[j] are both divisible by x . Given an array of integers keys , count the total number of possible attack vectors. For example, valid attack vectors for keys = [1, 2, 4] include: (0, 1, 1) : keys[0] = 1 and keys[1] = 2 are both divisible by 1 (0, 2, 1) : keys[0] = 1 and keys[2] = 4 are both divisible by 1 (1, 2, 2) : keys[1] = 2 and keys[2] = 4 are both divisible by 2 (2, 2, 4) : keys[2] = 4 and keys[2] = 4 are both divisible by 4 And others Given a network of n keys and a 2-d array queries of dimensions q * 2 , each query provides an inclusive range of integers to use as divisors. For each query, find the number of potential attack vectors (i, j, x) such that queries[k][0] ≤ x ≤ queries[k][1] . Report an array of exactly q integers where the i th element of the array is the answer to