xxxxxxxxxx
object Solution{
class LFUCache(var capacity: Int) {
var size = 0
var minFreq = 0
//LinkedListNode holds key and value pairs
var keyDict = new HashMap[Int, LinkedListNode]()
var freqDict = new HashMap[Int, MyLinkedList]()
def Get(key: Int): Int = {
//write your code here
-1
}
def Set(key: Int, value: Int): Unit = {
//write your code here
}
def print_cache(): String = {
var res:String = ""
for (key <- keyDict.keys) {
res += "(" + key + ", " + keyDict(key).`val` + ")"
}
res
}
}
}
xxxxxxxxxx
object Solution{
class LFUCache(var capacity: Int) {
var size = 0
var minFreq = 0
//LinkedListNode holds key and value pairs
var keyDict = new HashMap[Int, LinkedListNode]()
var freqDict = new HashMap[Int, MyLinkedList]()
def Get(key: Int): Int = {
//write your code here
-1
}
def Set(key: Int, value: Int): Unit = {
//write your code here
}
def print_cache(): String = {
var res:String = ""
for (key <- keyDict.keys) {
res += "(" + key + ", " + keyDict(key).`val` + ")"
}
res
}
}
}