Full Stack Software Engineer Interview Questions

15,799 full stack software engineer interview questions shared by candidates

given an array of integers, without reordering, determine the maximum difference between any element and prior smaller element. If there is never a lower prior element, return -1. example arr = [5,3,6,7,4] there are no earlier elements than arr[0]. there is no earlier reading with a value lower than arr[1]. there are two lower earlier readings with a value lower than arr[2]=6: • arr[2] - arr[1] = 6 - 3 = 3 • arr[2] - arr[0] = 6 - 5 = 1 there are three lower earlier readings with a lower value than arr[3]=7: • arr[3] - arr[2] = 7 - 6 = 1 • arr[3] - arr[1] = 7 - 3 =4 • arr[3] - arr[0] = 7 - 5 =2 there is one lower earlier reading with a lower value than arr[4]=4: • arr[4] - arr[1] = 4 - 3 = 1 the maximum trailing record is arr[3] - arr[1] = 4
avatar

Full Stack Developer

Interviewed at webiks

3.1
Jan 5, 2024

given an array of integers, without reordering, determine the maximum difference between any element and prior smaller element. If there is never a lower prior element, return -1. example arr = [5,3,6,7,4] there are no earlier elements than arr[0]. there is no earlier reading with a value lower than arr[1]. there are two lower earlier readings with a value lower than arr[2]=6: • arr[2] - arr[1] = 6 - 3 = 3 • arr[2] - arr[0] = 6 - 5 = 1 there are three lower earlier readings with a lower value than arr[3]=7: • arr[3] - arr[2] = 7 - 6 = 1 • arr[3] - arr[1] = 7 - 3 =4 • arr[3] - arr[0] = 7 - 5 =2 there is one lower earlier reading with a lower value than arr[4]=4: • arr[4] - arr[1] = 4 - 3 = 1 the maximum trailing record is arr[3] - arr[1] = 4

Viewing 1701 - 1710 interview questions

See Interview Questions for Similar Jobs

Glassdoor has 15,799 interview questions and reports from Full stack software engineer interviews. Prepare for your interview. Get hired. Love your job.