text: Function to perform queries to find number of distinct elements from a given index till last index in an array
code: function find_distinct ( a , n , q , queries ) { let MAX = 100001 ; let check = new Array ( MAX ) . fill ( 0 ) ; let idx = new Array ( MAX ) . fill ( 0 ) ; let cnt = 1 ; let i = n - 1 ; while ( i >= 0 ) {