ByteDance backend engineer interviews typically focus on APIs, databases, system design, concurrency, caching, and data structures.
No verified questions yet for ByteDance.
JobScheduler with the following methods:JobScheduler() — Initializes a job scheduler.void scheduleJob(string jobId, int interval, function jobFn) — Schedules a job to run every interval milliseconds.void cancelJob(string jobId) — Cancels the job with the given jobId.JobScheduler(), scheduleJob("job1", 3000, jobFn), cancelJob("job1")1 <= interval <= 10000RateLimiter with the following methods:RateLimiter(int limitPerMinute): Constructor to set the limit on requests per user.bool isAllowed(string userId): Determine if a request from userId is allowed for the current minute.void recordRequest(string userId): Record that a request was made by userId.RateLimiter(5), isAllowed("user1") => true, recordRequest("user1"), isAllowed("user1") => true, recordRequest("user1") => true (repeats until limit reached)1 <= limitPerMinute <= 100k distinct characters.longestSubstring(s: str, k: int) -> int that returns the length of the longest substring containing at most k distinct characters.longestSubstring("eceba", 2)3longestSubstring("aa", 1)21 <= s.length <= 10^50 <= k <= |s|maxProduct(nums: List[int]) -> int that returns the maximum product of a contiguous subarray in the given integer array nums.maxProduct([2, 3, -2, 4])62 * 3 = 6.maxProduct([-2, 0, -1])00.1 <= nums.length <= 2 * 10^4-100 <= nums[i] <= 100Sign up for free to access walkthroughs, AI-generated questions, and more.
Get Started Free