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.
First of all the comparison function does not return true or false, it returns a number, say the function compares x and y, if returns 0 means 2 elements are equal, if greater than 0 means x > y if smaller than 0 means x < y.
Now back to the function, first , if string x and y both are in same length, then use the comparison function provided by string. if not use length of x minus the length y. That's the result we would want.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Big Sorting
You are viewing a single comment's thread. Return to all comments →
First of all the comparison function does not return true or false, it returns a number, say the function compares x and y, if returns 0 means 2 elements are equal, if greater than 0 means x > y if smaller than 0 means x < y.
Now back to the function, first , if string x and y both are in same length, then use the comparison function provided by string. if not use length of x minus the length y. That's the result we would want.