New
ML System Design & SQL tracks just landed
See what's new
×
Question Bank
Pricing
Blog
Forum
HOT
JobRadar
NEW
Referral
Description
Solution
Discussion
Submissions
Ask AI
Question Bank
Capital One
Coding Question
AI Insights
Quick Summary
Find the smallest contiguous subset of batteries in a circular arrangement that can sustain a call for a specified duration.
Each battery alternates between powering the device and recharging while others are in use.
A valid segment must provide enough total usage time to cover both the call length and the worst-case recharge delay.
What This Tests
Circular array manipulation
Prefix sum for O(1) range calculations
Feasibility condition derivation
Optimization over sliding ranges
Common Patterns
Prefix Sum
Two Pointers
Sliding Window
Collapse
Hint 1
Hint 2
What Interviewers May Ask Next
Accepted
1.1k
/2k
Acceptance Rate
56.3%
Ask AI Assistant
Ask AI Assistant
Ask me anything about this coding question!
Qwen
Qwen3.6-Flash
0/2000
Auto
Debug
Run
Submit
Test Cases
Input
callDuration =
usageDuration =
chargeTime =
Output
Expected