Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lab3: letter frequency #612

Open
ailyntang opened this issue Aug 27, 2019 · 0 comments
Open

Lab3: letter frequency #612

ailyntang opened this issue Aug 27, 2019 · 0 comments

Comments

@ailyntang
Copy link
Collaborator

Lab 3 - Letter frequency

Write a function that returns a mapping of each letter to its frequency:
func letters(s string) map[rune]int

Write a function that returns a sorted slice of strings with elements "{key}:{val}". Use package sort:
func sortLetters(m map[rune]int) []string

Call fmt.Println(strings.Join(sortLetters(letters("aba")), "\n")) in main to print:
a:2
b:1
Bonus points: comprehensive tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant