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

Add mentor notes Kotlin/Anagram #2132

Merged
merged 2 commits into from
Feb 16, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions tracks/kotlin/exercises/anagram/mentoring.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# Mentoring

## Reasonable Solutions
```kotlin
class Anagram(var anagram: String){
fun match(list: List<String>): Set<String>{
return list.filter {
it.lowercase() != anagram.lowercase() && it.order() == anagram.order()
}.toSet()
}

private fun String.order(): List<Char>{
return this.map { it.lowercaseChar() }.sorted()
}
}
```

## Common suggestions
* Function `sorted()` can be used to sort according to the characters natural sort order
SleeplessByte marked this conversation as resolved.
Show resolved Hide resolved