fastest and memory efficient code: Runtime- 7 ms Beats 87.46%, Memory- 9.21 MB Beats 84.95%
ApproachInstead of storing whole words again, just store idx (strs[idx]) in map[sortedword] = [[0], [1,2], [3,4,5]] like this. And then generate slice of string
# Approach
Instead of storing whole words again, just store idx (strs[idx]) in map[sortedword] = [[0], [1,2], [3,4,5]] like this. And then generate slice of string using these indices.

# Complexity
- Time complexity:
7 ms Beats 87.46%

- Space complexity:
9.21 MB Beats 84.95%

# Code
```golang []
import "slices"

func groupAnagrams(strs []string) [][]string {
	anagramMap := make(map[string][]int)

    // Sorting rune for faster runtime
	for idx, word := range strs {
        sortedRune := []rune(word)
        slices.Sort(sortedRune)
        sortedWord := string(sortedRune)
		anagramMap[sortedWord] = append(anagramMap[sortedWord], idx)
	}

	// Convert map values to a slice of slices
	result := make([][]string, 0, len(anagramMap))
	for _, group := range anagramMap {
        r := []string{}
        for _, idx := range group {
            r = append(r, strs[idx])
        }
        result = append(result, r)
	}

	return result
}

```
['Go']