Remainder of array multiplication
Easy Accuracy: 36.91% Submissions: 339 Points: 2

You are given an array arr[] of numbers of size N. You need to multiply these numbers and find the remainder when the product of these numbers is divided by a number K.

Example 1:

Input:
N = 3
arr[] = {4, 6, 7}
K = 3
Output:
0
Explanation:
4*6*7 = 168%3 = 0

Example 2:

Input:
N = 2
arr[] = {1, 6}
K = 5
Output:
1
Explanation:
1*6 = 6%5 = 1

You don't need to read input or print anything. Your task is to complete the function remArray() which takes a integers N, an array arr[] of size N and another integer K as input and returns the Product of the array modulo K.

Expected Time Complexity: O(N)
Expected Auxiliary Space: O(1)

Constraints:
1 <= N,K,arr[i] <= 105

We are replacing the old Disqus forum with the new Discussions section given below.

### Editorial

We strongly recommend solving this problem on your own before viewing its editorial. Do you still want to view the editorial?

#### My Submissions:  