Throttle — LeetCode 2676 Python Solution
MediumLeetCode PremiumJavaScript
- Problem
- #2676
- 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
| Measure | Complexity |
|---|---|
| Time | O(n) |
| Space | O(1) to O(n) auxiliary |
Related problems
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.