MediumNo. 2676LeetCode Premium
Throttle — LeetCode 2676 Python Solution
- Topics
- JavaScript
- Reading time
- 2 min
- Source
- leetcode.com
The problem
Given a function fn and a time in milliseconds t, return a throttled version of that function. A throttled function is first called without delay and then, for a time interval of t milliseconds, can't be executed but should store the latest function arguments provided to call fn with them after the end of the delay.
Example
- Input
- t = 100,
- Output
- [{"t":20,"inputs":[1]}]
- Explanation
- The 1st call is always called without delay
Complexity
- Time
- O(n)
- Space · auxiliary
- O(1) to O(n)
Related problems
| No. | Problem | Difficulty |
|---|---|---|
| 2672 | Number of Adjacent Elements With the Same Color | Medium |
| 0057 | Insert Interval | Medium |
| 0192 | Word Frequency | Medium |
| 0193 | Valid Phone Numbers | Easy |
| 0194 | Transpose File | Medium |
| 0195 | Tenth Line | Easy |
Frequently asked questions
- How hard is LeetCode 2676. Throttle?
LeetCode 2676. Throttle is rated Medium on LeetCode.
- What topics does LeetCode 2676. Throttle cover?
LeetCode 2676. Throttle is tagged JavaScript on LeetCode.
- Is LeetCode 2676. Throttle a premium problem?
Yes. LeetCode 2676. Throttle is a LeetCode Premium problem, so the full statement and test cases require a paid LeetCode subscription.