Company: natwest hackathon_29march
Difficulty: medium
Statement Given a sequence a1, a2, ..., an . Your task is to [unclear] a path through the [unclear] each number in the path [unclear] the next number in the path, and the sum of the [unclear] in the path, when taken modulo K , equals 0. To clarify: A valid [unclear] consists of contiguous elements of the sequence, where the first [unclear] divides the second, the second divides the [unclear] and so on. The [unclear] of the numbers in [unclear] when taken modulo K [unclear] divisible by K . Task: You need to return the length of the longest valid path that satisfies the conditions mentioned above. If no valid path exists, return -1. Input Format The first line contains two integers: n — the number of elements in the sequence. K — the integer for the modulo condition. The second line contains n integers: a1, a2, a3, ..., an — the sequence of integers. Output Format Return the length of the longest valid path where the sum modulo K is 0 and each number divides the next one. If no such pat