Challenge 08 - Check Permutations Image Challenge 08 - Check Permutations

👋 Welcome Gophers! In this Go challenge, you are going to be implementing a function that takes in two string values and checks to see if they are permutations of one another.

Example

If I have 2 strings, “abc” and “cba”, when I pass these strings into the function, it should return true as these two strings are permutations of each other.

Hints

You can iterate through all the characters in a string using the range keyword in a for loop

// prints out the position and the rune
for pos, char := range str1 {
  fmt.Printf("%d: %c\n", pos, char)
}

Start off by building up a map of these rune values to the number of occurrences in one for loop and then work from there.

See the Solution

Feel free to have a look at the forum discussion thread for this challenge and contribute with your own solutions here - Challenge 08 - Checking Permutations

Further Reading:

If you enjoyed this challenge, you may also enjoy some of these other challenges:


Other Challenges