Closed tlee418 closed 10 years ago
Have you tried running the test with this?
Two thoughts:
(1) Do you want to do the work of str.split("").sort
for every word? Does the result ever change?
(2) The function is supposed to return an array of anagrams, not just print them out and return nil
.
Hi imurchie,
Thanks for reading the input. If I modify puts anagrams to return anagrams, would it solve the problem?
I try testing with it and it seems to be getting the result correctly. Please correct me if I am wrong.
Thank you.
If you return the anagrams array, the tests pass. Otherwise none should work. Are you running the specs as per the instructions?
cd prep-work/coding-test-2/practice-problems
rake spec spec/06_word_unscrambler_spec.rb
Prefer readability over one liners.
I've checked in a two-liner solution with a comment that the longer version is to be more readable to beginners. :-)
Hi, I am a beginner who applied for app academy. I edited this because the solution can be a bit more simplified. Thanks.