Practice Go: Secret Message @ Alex Pliutau's Blog
阿新 • • 發佈:2018-12-29
I just created a new challenge in Practice Go collection, happy to review all possible solutions and choose the best one.
Secret Message
Create a function to decode a secret message, to do it you have to:
- Sort the characters in the encoded string by the number of times this character appears in it (descending).
- Now take the sorted string, and drop all the characters after (and including) the _
Examples
b_bcb_ => b_c => b
How to solve
- Each folder has a README.md file and _test.go file, check it and find what kind of function you need to implement.
- Code this function in the separate .go file inside a package and run tests. You may use anything you want except 3rd-party packages.
- Create a PR with one .go file.
- We will choose the most fast and elegant solution and merge into the repo within 7 days.
Run tests with benchmarks
go test -bench .