Algorithm/LeetCode2 [LeetCode] 2622. Cache With Time Limit Promise and Time 문제 Write a class that allows getting and setting key-value pairs, however a time until expiration is associated with each key. The class has three public methods: set(key, value, duration): accepts an integer key, an integer value, and a duration in milliseconds. Once the duration has elapsed, the key should be inaccessible. The method should return true if the same un-expired k.. 2023. 11. 13. [LeetCode] 2620. Counter : 클로저 문제 Given an integer n, return a counter function. This counter function initially returns n and then returns 1 more than the previous value every subsequent time it is called (n, n + 1, n + 2, etc). 정수 n이 주어질 때, counter 함수를 리턴하세요. 이 counter 함수는 초기에는 n을 리턴하며 이후에는 호출될 때마다 이전 값보다 1씩 큰 값을 리턴합니다. 예시 Example 1: Input: n = 10 ["call","call","call"] Output: [10,11,12] Explanation: counter() = 10 // The .. 2023. 11. 11. 이전 1 다음