MCPcopy Create free account
hub / github.com/ByteByteGoHq/coding-interview-patterns / Pair

Class Pair

kotlin/Heaps/KMostFrequentStringsMaxHeap.kt:3–3  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1import java.util.PriorityQueue
2
3data class Pair(val str: String, val freq: Int)
4
5fun kMostFrequentStringsMaxHeap(strs: List<String>, k: Int): List<String> {
6 // We use 'groupingBy' to create a hash map that counts the frequency

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected