problem: https://leetcode.com/problems/majority-element/submissions/
solution: https://ide.codingblocks.com/s/401354
Is it possible to make this approach work with frequency array it is not working for negative numbers
problem: https://leetcode.com/problems/majority-element/submissions/
solution: https://ide.codingblocks.com/s/401354
Is it possible to make this approach work with frequency array it is not working for negative numbers
Yeah this approach will not work for -ve elements
You can use a freq map instead then it will work
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.