Cannot find the bug in the code…Please help
Cannot debug the code
hi @sayanwinz, one mistake that i am able to point out is that you are not calculating the ans for query with input = 1.
Try counting the multiples of 1 as well.
I have made very minor changes to get an AC.
1st : when marking the count of elements only traverse ar till n instead of N as size of ar is n.
2nd : when calculating ans for all numbers, also calculate ans for i = 1.
Hope this helps