1.Given an array containing N integers and a positive integer K. 2.The task is to find the length of the longest sub array with sum of the elements divisible by the given value K. 3.You have to complete the function print() which should print the length of the longest sub array with sum of elements divisible by the given value of K.
Input Format
1.First Line contains a positive integer 'N' denoting the size of the array. 2.Second line contains 'N' spaced elements array of the array., 3.Third line containing an integer 'k'. 4.Example Input : A[] = {2, 7, 6, 1, 4, 5}, K = 3 Output : 4 The subarray is {7, 6, 1, 4} with sum 18, which is divisible by 3.
Output Format
Print the value of length of longest sub arrray with sum divisible by k.
Constraints
1<=N,K<=10^6 -10^5<=A[i]<=10^5
Notice
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.Example
Input
6 2 7 6 1 4 5 3
Output
4