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.
It's unclear from the problem description, whether the numbers in list B have to appear in the same order as in list A - else I don't see much sense in not ordering them by size.
Especially if the result has to be given ordered by number, not by same ordering as appearing in list B.
I succeeded with the scala standard function List.diff (List).toSet.toList.sorted, after previously misinterpreting the challenge and solving by hand, but failing.
Generated some testdata to check for the time it takes to solve for two lists of about 100k numbers - about 2s.
But doesn't scalas diff function sort internally? Don't know and didn't check.
If the order in B is totally arbitrary, this should be stated clearly, I think, or the example shouldn't look so much same sorted.
Yes, with more careful reading, I could have mentioned earlier, that only elements missing in B are searched for.
What I don't like about the challenges, is, that we have to invest hackos, for receiving additional information about the test cases without indication, which test case is most useful for us. And there is no indication, what the time limit is and how much we're off. Timings and results vs. expected results should be public.
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Missing Numbers (FP)
You are viewing a single comment's thread. Return to all comments →
It's unclear from the problem description, whether the numbers in list B have to appear in the same order as in list A - else I don't see much sense in not ordering them by size.
Especially if the result has to be given ordered by number, not by same ordering as appearing in list B.
I succeeded with the scala standard function List.diff (List).toSet.toList.sorted, after previously misinterpreting the challenge and solving by hand, but failing.
Generated some testdata to check for the time it takes to solve for two lists of about 100k numbers - about 2s.
But doesn't scalas diff function sort internally? Don't know and didn't check.
If the order in B is totally arbitrary, this should be stated clearly, I think, or the example shouldn't look so much same sorted.
Yes, with more careful reading, I could have mentioned earlier, that only elements missing in B are searched for.
What I don't like about the challenges, is, that we have to invest hackos, for receiving additional information about the test cases without indication, which test case is most useful for us. And there is no indication, what the time limit is and how much we're off. Timings and results vs. expected results should be public.