Company: Tredence_25july
Difficulty: medium
Computing functions Problem Description You are given an array A of size N and Q tasks. In each task, you are given an integer M . For each task, you need to compute the value of ans using the following logic: ans = 0; modulo = 10^M; // 10 to the power M for (i from 0 to N-1) // Assuming 0-indexed array A { if ((factorial of A[i]) % modulo == 0) ans = ans + 1; } Complete the solve function. The function takes the following 4 parameters and should return a list of ans values, one for each task. Parameters: N : Represents the size of array A . A : Represents the elements of the array. Q : Represents the number of tasks. task : A list of integers, where each element task[j] is the integer M for the j -th task. Examples Example 1: Input: N = 3 A = [4, 5, 6] Q = 1 task = [1] (M for the task is 1) Output: [2] Explanation: For the given task, M = 1 . Therefore, modulo = 10^1 = 10 . Iterating through array A : For A[0] = 4 : factorial(4) = 24 . 24 % 10 = 4 . Since 4 != 0 , ans remains 0 . For