You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set.
2
+
3
+
// get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1.
4
+
// set(key, value) - Set or insert the value if the key is not already present. When the cache reached its capacity, it should invalidate the least recently used item before inserting a new item.
// Write a program to check whether a given number is an ugly number.
4
+
5
+
// Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 6, 8 are ugly while 14 is not ugly since it includes another prime factor 7.
6
+
7
+
// Note that 1 is typically treated as an ugly number.
// Ugly numbers are positive numbers whose prime factors only include 2, 3, 5. For example, 1, 2, 3, 4, 5, 6, 8, 9, 10, 12 is the sequence of the first 10 ugly numbers.
6
+
7
+
// Note that 1 is typically treated as an ugly number.
0 commit comments