Frequency Queries

  • + 1 comment

    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);