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.
I guess this one can be solved in a lot of different ways...
list.reversed() before transforming it to array, or using [::-1] to sort.
But feeling like the idea of this "challange" is to get common with "numpy" module and to use all of it's capabilities. Even tho this is not relevant in this particular task and given test cases but using flipud would be the best approach from learning perspective.
However from some reserches done by other people () - either slicing [::-1]or flipud gives almost the same performance results bigger the array becomes. But defenitely outperforms list.reverse()
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Arrays
You are viewing a single comment's thread. Return to all comments →
I guess this one can be solved in a lot of different ways... list.reversed() before transforming it to array, or using [::-1] to sort. But feeling like the idea of this "challange" is to get common with "numpy" module and to use all of it's capabilities. Even tho this is not relevant in this particular task and given test cases but using
flipud
would be the best approach from learning perspective. However from some reserches done by other people () - either slicing[::-1]
orflipud
gives almost the same performance results bigger the array becomes. But defenitely outperformslist.reverse()