Example 1 · empty
- Arguments
- words
[]
- Expected return
[]
Test data
- Input
{"words":[]}- Expected output
[]
Put words with the same letter counts into the same group.
func GroupAnagrams(words []string) [][]stringExamples use {"words": [...]}.
The runner calls your functions directly; you do not need to parse JSON.
[]
[]
{"words":[]}[]
[ "tea", "tan", "eat", "ate", "nat", "bat" ]
[
[
"tea",
"eat",
"ate"
],
[
"tan",
"nat"
],
[
"bat"
]
]{"words":["tea","tan","eat","ate","nat","bat"]}[["tea","eat","ate"],["tan","nat"],["bat"]]
[ "ab", "aab", "ba", "aba" ]
[
[
"ab",
"ba"
],
[
"aab",
"aba"
]
]{"words":["ab","aab","ba","aba"]}[["ab","ba"],["aab","aba"]]
[ "", "a", "", "a" ]
[
[
"",
""
],
[
"a",
"a"
]
]{"words":["","a","","a"]}[["",""],["a","a"]]
Loading…
Checking execution availability…
View inputs and expected outputs. Examples do not run your code.