Panda Guru LogoPanda
Guru

Amazon SDE Full Time Role Interview Coding Problem India

Round 1

Questions: *A conveyor belt at a recycling plant contains a sequence of bottles represented by the string: 'a' represents aluminum cans, 'b' represents glass bottles, and 'c' represents plastic containers. The plant needs to collect at least k items of each type ('a', 'b', and 'c') for a complete recycling process.

Each minute, a worker can pick up either the leftmost or the rightmost item from the conveyor belt.

Determine the minimum number of minutes required for the worker to collect at least k items of each type.

If it is impossible to collect k items of each type, return -1.

Input: A string conveyorbelt representing the sequence of bottles on the conveyor belt. An integer k representing the minimum number of items of each type needed.

Output: Return the minimum number of minutes required, or -1 if it is impossible.

Example:

Input: Conveyor belt = "aabaaacaabc", k = 2

Output: 8*

Interviewers keep interrupting constantly.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.