How can we make an array of size max(a[i]) as constraints are 10^9. My code works fine otherwise (i.e., when a[i] is small). What change should I make ? Code link: https://ide.codingblocks.com/s/164026
Mike and Hashtrick probem
Hello @raj.bmp.333,
You don’t have to create such large sized array.
Try to use a hash map instead.
You can refer to the following, if you don’t figure out anything.
Let me know if you don’t understand anything.
Hope, this would help.
Give a like if you are satisfied.
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.
check out the link…it can easily be solved using 2 maps…In O(n)…
If use sorting then it will take O(nlog(n)) time complexity…