Custom Interval — LeetCode 2805 Python Solution

MediumLeetCode PremiumJavaScript
Problem
#2805
Reading time
2 min

The problem

Function customInterval Given a function fn, a number delay and a number period, return a number id. customInterval is a function that should execute the provided function fn at intervals based on a linear pattern defined by the formula delay + period * count.

Example

Input
delay = 50, period = 20, cancelTime = 225
Output
[50,120,210]
Explanation
const t = performance.now()

Complexity

MeasureComplexity
TimeO(n)
SpaceO(1) to O(n) auxiliary

Related problems

Frequently asked questions

How hard is LeetCode 2805. Custom Interval?
LeetCode 2805. Custom Interval is rated Medium on LeetCode.
What topics does LeetCode 2805. Custom Interval cover?
LeetCode 2805. Custom Interval is tagged JavaScript on LeetCode.
Is LeetCode 2805. Custom Interval a premium problem?
Yes. LeetCode 2805. Custom Interval is a LeetCode Premium problem, so the full statement and test cases require a paid LeetCode subscription.

Stuck on problems like this in a live interview?

Stealth Interview is a desktop app for macOS and Windows. It reads the problem off your screen and returns a working solution with a step-by-step explanation and its time and space complexity — invisible to screen sharing.

Get Stealth Interview