Is my approach correct for this question.
It is not giving correct output too.
What to do?
Please tell me another approach to follow for O(logN) ?
Is my approach correct
@aryangrover
hello Aryan,
use hashing to make ur program general (ie it should work for other numbers as well apart from 0 1 2 3)
we dont have Log(N) approach for this problem .
resason -> to calculate frequency we need to traverse the complete array atleast once.
which makes Our time complexity O(n).
Yes Sir, I will be using Hashing only. I was just asking this way is Ok for that.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.