Sde Interview Questions

16,639 sde interview questions shared by candidates

Can you explain what the pseudo-code below is trying to do? array[N] # array of N integers, indexed 0 to N-1; # assume it’s populated with [1,4,2,-2,-9,10,2,12,2,-4,-4,-4,-4,2,6,7] peak = array[0] index = 0 output = [] # array of tuples For x in 1..N-1 if (array[x]*array[x-1] > 0) if peak < 0 and array[x] < peak peak = array[x] index = x if peak >= 0 and array[x] > peak peak = array[x] index = x else output.insert( (index, peak) ) peak = array[x] index = x end if end for return output
avatar

Software Development Engineer (SDE)

Interviewed at PriceLabs

4.5
Aug 5, 2024

Can you explain what the pseudo-code below is trying to do? array[N] # array of N integers, indexed 0 to N-1; # assume it’s populated with [1,4,2,-2,-9,10,2,12,2,-4,-4,-4,-4,2,6,7] peak = array[0] index = 0 output = [] # array of tuples For x in 1..N-1 if (array[x]*array[x-1] > 0) if peak < 0 and array[x] < peak peak = array[x] index = x if peak >= 0 and array[x] > peak peak = array[x] index = x else output.insert( (index, peak) ) peak = array[x] index = x end if end for return output

Viewing 1691 - 1700 interview questions

Glassdoor has 16,639 interview questions and reports from Sde interviews. Prepare for your interview. Get hired. Love your job.