Backend Software Engineer Interview Questions

2,345 backend software engineer interview questions shared by candidates

There are N soldiers standing in a line. Each soldier is assigned a ranking value. You are giving medals to these soldiers subjected to the following requirements: 1) Each soldier must have at least one medal. 2) Soldiers with a higher ranking get more medals than their neighbors. What is the minimum medals you must give? Input 1: 1 0 2 Output 1: [2, 1, 2] Input 2: 1 2 2 Output 2: [1,2,1] Input 3: 1 2 4 5 5 5 4 3 2 1 Output 3: [1,2,3,4,1,5,4,3,2,1]
avatar

Software Engineer, Backend

Interviewed at Tracxn

2.8
Aug 9, 2019

There are N soldiers standing in a line. Each soldier is assigned a ranking value. You are giving medals to these soldiers subjected to the following requirements: 1) Each soldier must have at least one medal. 2) Soldiers with a higher ranking get more medals than their neighbors. What is the minimum medals you must give? Input 1: 1 0 2 Output 1: [2, 1, 2] Input 2: 1 2 2 Output 2: [1,2,1] Input 3: 1 2 4 5 5 5 4 3 2 1 Output 3: [1,2,3,4,1,5,4,3,2,1]

Viewing 2101 - 2110 interview questions

Glassdoor has 2,345 interview questions and reports from Backend software engineer interviews. Prepare for your interview. Get hired. Love your job.