Panda Guru LogoPanda
Guru

SDE | Waffor | Interview Question need Optimal Approach

Round 1

Questions: You are given a binary grid of size B x A where:

Input

1 1 1 1 0 0 1 0 0

Output : 1

Observation :

Input

1 0 0 0 0 1 0 0 0 1 0 0

Output : 3

Observation

Brute Force Approach

  1. Identify all fresh oranges (represented by 1)
  2. Generate all possible combinations of rotten oranges (represented by 0)
  3. Check if a combination rots all fresh oranges
  4. Store the minimum number of rotten oranges needed and return
Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.