Function to count number of sub - arrays whose sum is k ^ p where p >= 0
function countSubarrays ( arr , n , k ) { let prefix_sum = new Array ( MAX ) ; prefix_sum [ 0 ] = 0 ; prefix_sum = partial_sum ( prefix_sum , arr , n ) ; let sum ; if ( k == 1 ) { sum = 0 ; let m = new Map ( ) ; for ( let i = n ; i >= 0 ; i -- ) {