We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
create a map for **long long ** **datatype,as the limit is 10^6.
Then add the element accordingly.
you dont even need an array for storing elements,just create a map and done :).
Counting Sort 1
You are viewing a single comment's thread. Return to all comments →
Array we create for keeping numbers is 0 to 100 not 0 to N. Just keep that in mind ;)
i missed that in first submission :p
Full python solution.
Hackerrank - Counting Sort 1 Solution
here is problem solution in java python c++ c and javascript programming. https://programs.programmingoneonone.com/2021/04/hackerrank-counting-sort-1-solution.html
Great tip, also got me. Using N = 100 in the example was a bit misleading.
Hey, I dont understand the problem statement.Can you please elaborate
create a map for **long long ** **datatype,as the limit is 10^6. Then add the element accordingly. you dont even need an array for storing elements,just create a map and done :).
Go through this simple code
include
include
using namespace std ;
int main(){
}
i submitted like 10 times ..then i saw your comment :P ..thanks
Thanks, hackerrank catched me)
caught*
Liteally every one gets stuck here!
Thanks a lot
And here I already submitted it 5 times. Thank you man.
Thanks I missed that too in first submission!
lol my god thanks dude
but why only 0 to 100?
This one comment woke me up after re-running my code 7 times, with various logics to optimize the running time. Will try to be more open-minded 😕
okay , but why what is the difference ?
Thanks!!
Thanks man solved my issue solution in js https://jsbin.com/lajiqekako/1/edit?js,console