You are viewing a single comment's thread. Return to all comments →
If the frequency is greater than 10^5 then add 0 to the List, b/c the frequency of any number cannot exceed the value of 10^5.
Just Add the below condition, all the test cases will pass.
if(value > 100000) result.add(0);
else result.add(arr[value] > 0 ? 1 : 0);
Seems like cookies are disabled on this browser, please enable them to open this website
Frequency Queries
You are viewing a single comment's thread. Return to all comments →
If the frequency is greater than 10^5 then add 0 to the List, b/c the frequency of any number cannot exceed the value of 10^5.
Just Add the below condition, all the test cases will pass.
if(value > 100000) result.add(0);
else
result.add(arr[value] > 0 ? 1 : 0);