solulubeta
Sign in
Story Problems / Arrays, windows & two pointers
01.03 · Problem

Fewest Shifts to Reach the Target

Medium Variable window (shortest with sum ≥ target) Pro

This problem is part of solulu Pro

A courier must log at least target working hours. Each shift on the roster has a positive number of hours, and he can only take a block of consecutive shifts. What is the smallest number of shifts he needs? Return 0 if…

Lifetime ₹2,000 ₹1,000 · Beta offer
Mark this problem as solved when you are finished.

Item 3 of 94 · updated 2026-10-12