FastPrepLight the Whole Street With Fewest Bulbs
Problems/Light the Whole Street With Fewest Bulbs

Light the Whole Street With Fewest Bulbs

Adobe logoAdobe● MediumFULLTIMEPHONE SCREEN

Updated Nov 2026

QuestionFunctionExamplesConstraints

Problem statement

Source note: This problem asks whether a street of working and broken bulbs can be fully lit, and if so, how few working bulbs need to be on. A post about a Computer Scientist interview at Adobe's Noida office (held in July 2022, rejected, posted in August 2022) gives this as the first-round task. Each working bulb reaches k positions on both sides. The first question is whether every position can be lit, and a follow-up asks for the smallest number of bulbs to switch on. It shows one sample street but gives no limits. It does not say what the follow-up should return when the street cannot be lit.

Our choices: both parts are answered by one number, -1 when the street cannot be lit and otherwise the fewest bulbs. A bulb lights its own position and the k positions on each side. Positions with broken bulbs must be lit too. There are 1 to 10^4 positions, with 0 <= k <= the street's length. The examples are new instead of the post's sample.

Our version is about 85% the same as the reported question.

A street has n positions in a row, numbered 0 to n - 1, with one bulb at each position. street[i] = 1 means the bulb at position i works, and street[i] = 0 means it is broken. A working bulb that is switched on lights its own position and every position up to k steps to its left and to its right: positions i - k to i + k that exist. A broken bulb gives no light, but its position still has to be lit.

This problem has two parts, answered by one number:

  1. Can the whole street be lit, even with every working bulb switched on? If not, return -1.
  2. If it can, return the fewest working bulbs that must be switched on so that every position is lit.

Function

minBulbs(street: int[], k: int) → int

Examples

Example 1

street = [0,0,1,0,1,1,0,0,1,0]k = 2return = 3

Working bulbs stand at positions 2, 4, 5 and 8, and each lights 2 steps to each side. The bulb at 2 lights 0 to 4, and the bulb at 8 lights 6 to 9, leaving position 5 dark; the bulb at 5 lights 3 to 7, which fills the gap. So 3 bulbs (2, 5, 8) light the whole street. Two cannot: only the bulb at 2 reaches position 0 and only the bulb at 8 reaches position 9, and those two leave 5 dark. The answer is 3.

Example 2

street = [1,0,0,0,0,1]k = 1return = -1

The bulb at position 0 lights positions 0 and 1, and the bulb at position 5 lights 4 and 5. Positions 2 and 3 stay dark even with every working bulb on, so the street cannot be lit: the answer is -1.

Example 3

street = [1,1,1]k = 0return = 3

With k = 0 a bulb lights only its own position, so every position needs its own working bulb, and all three must be on.

Constraints

  • 1 <= street.length <= 10^4
  • each street[i] is 0 or 1
  • 0 <= k <= street.length

More Adobe Phone Screen questions

  • Evaluate a Parenthesized Integer ExpressionPHONE SCREEN · Seen Oct 2026
  • All Elements of Two BSTs in OrderPHONE SCREEN · Seen Aug 2026
  • Rotate an Array In PlaceOA · PHONE SCREEN · Seen Aug 2026
  • Binary Tree Level-Order Traversal by LevelsPHONE SCREEN · ONSITE INTERVIEW · Seen Aug 2026
  • Count Occurrences in a Sorted ArrayPHONE SCREEN · ONSITE INTERVIEW · Seen Jul 2026
  • Count Pairs with Absolute Difference KPHONE SCREEN · Seen Jul 2026
  • Count Subsets with Sum KPHONE SCREEN · Seen Jul 2026
  • Numbers with Exactly Three DivisorsPHONE SCREEN · Seen Jul 2026
  • Sum of Even Nodes on a Path in a Numbered Binary TreePHONE SCREEN · Seen Jul 2026
  • Largest Value in Every Sliding WindowPHONE SCREEN · Seen Jul 2026

Similar questions at other companies

  • Tennis Court SchedulingAtlassian · PHONE SCREEN · ONSITE INTERVIEWAtlassian interview questions
  • Jump GamePaytm · PHONE SCREENPaytm interview questions
  • Maximum Number of Events That Can Be AttendedByteDance · PHONE SCREENByteDance interview questions
  • Remove the Fewest Magic BeansThe D.E. Shaw Group · PHONE SCREENThe D.E. Shaw Group interview questions
  • Gas Station CircuitAngel One · PHONE SCREEN
  • Aggressive CowsAmazon · PHONE SCREEN
  • Minimum Cost for a Target WeightPace Stock Broking Services · PHONE SCREEN
  • Defer Expenses to Preserve BalanceDRW · PHONE SCREENDRW interview questions
  • Container With Most WaterEPAM · PHONE SCREENEPAM interview questions
  • Task Scheduler with CooldownTeradata · PHONE SCREEN

Interview reports that mention this question

  • Adobe CS1 Interviews: 14 Experiences (Part 4 of 6)

Adobe interview experiences

  • Adobe Web, QA, DevOps, ML Roles: 13 Experiences (Part 3 of 3)
  • Adobe SWE Interviews, Level Unknown: 25 Experiences (Part 2 of 3)
  • Adobe Interviews, Level Unknown: 38 Experiences (Part 1 of 3)
  • Adobe New Grad MTS Interview Questions: 7 Experiences
  • Adobe ML/Research Intern Interviews: 12 Experiences (Part 4 of 4)
All Adobe interview questionsSee Adobe hiring insights
Saved
class Solution {
    public int minBulbs(int[] street, int k) {
        // Write your code here.
    }
}
Checking account…