In Ruby MRI 2.5.0, If you add assertion messaage with a '\n in it. The message after the newline character will be logged as a regular message instead of an error message.

puts "Uncomment the test cases to see the errors"

In Node v12, if you overwrite Math.pow with a function that throws an error, it will automatically triggered despite there is no code in the Code, Preloaded, and Test Cases section that calls them. Maybe used by the test framework?

This behavior does not appear in Node v8 or v10.


Not tested locally (only tested it on Codewars).

// Switch to Node v12 to see the error
console.log("Hello, World!")

Your job is to group the words in anagrams.

What is an anagram ?

star and tsar are anagram of each other because you can rearrange the letters for star to obtain tsar.


A typical test could be :

// input
groupAnagrams(["tsar", "rat", "tar", "star", "tars", "cheese"]);

// output
  ["tsar", "star", "tars"],
  ["rat", "tar"],
## Helpers

The method `assertSimilarUnsorted` has been preloaded for you **in the Solution Sandbox only** to compare to arrays without relying on the sorting of the elements.

`assertSimilarUnsorted([[1,2], [3]], [[3], [1,2]]); // returns true`

Hvae unf !

I'd advise you to find an efficient way for grouping the words in anagrams otherwise you'll probably won't pass the heavy superhero test cases

def group_anagrams(words):
    def sort_word(word):
        charlist = list(word)
        return "".join(charlist)
    anagrams = {}
    for word in words:
        sorted = sort_word(word)
        if sorted in anagrams:
            anagrams[sorted] = [word]
    return list(anagrams.values())