Panda Guru LogoPanda
Guru

Amazon Interview SDE1

Round 1

Questions: Given an array of positive integers including 0. At each operation, you can choose a non-empty subarray and decrement all elements in it by 1. Find the minimum number of operations required to make all elements of the array equal to 0.

For example:

arr = [3,1,4,2]

Total => 1 + 1 + 2 + 2 = 6

So, ans = 6

Constraint: Size of the array can be 1e5.

Expected to do it in O(NlogN) or better.

Candidate's Approach

No approach provided.

Interviewer's Feedback

No feedback provided.