In this case, I take n = 1,000,000
The first query is likely O(log(x)) where x is number of distinct values of a. I approximated that to be O(1) relative to n.
I could be wrong here, or we could have seen different questions, or we are just interpreting the question differently.
In this case, I take n = 1,000,000
The first query is likely O(log(x)) where x is number of distinct values of a. I approximated that to be O(1) relative to n.
I could be wrong here, or we could have seen different questions, or we are just interpreting the question differently.