They are the same.
> You've modified is_deeply such that any additional tests added to @tests must have the results in ascending order for the is_deeply test to be successful.
OK, if you prefer to order them during the tests, so be it.
> There were no duplicates. I added (different) tests such that the result could be in "any order".
hmm ... those seemingly different "any order" arrays are sorted to the same expect-part in the tests.
Hence half of your tests are redundant and violate the DRY principle.
I really don't know how to explain it any better.
FWIW: one actually needs more tests if the input isn't unique, since those cases are different but legit solutions.
[[2,7,7,15], 9, [0,1]], [[2,7,7,15], 9, [0,2]],
another case for multiple solutions would be
[[2,7,4,5], 9, [0,1]], [[2,7,4,5], 9, [2,3]],
Cheers Rolf
(addicted to the Perl Programming Language :)
Wikisyntax for the Monastery
In reply to Re^7: LeetCode Problem #1 - Two Sum - Improve and/or discuss.
by LanX
in thread LeetCode Problem #1 - Two Sum - Improve and/or discuss.
by kcott
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |