Senior Backend Engineer Interview Questions

2,039 senior backend engineer interview questions shared by candidates

A high-speed camera is set up at 90 degrees to a segment of road, so it can take snapshots of the road as cars drive past. All cars move with the same speed, but in different directions: some cars move to the right, while others move toward the left. Each car moves in its own lane, so they don’t interfere with each other’s movement. The camera will snapshot positions of cars on the road in a one-dimensional projection. We would like to see the time series of snapshots until the moment when all cars leave the camera view. You need to implement a Snapshot method that accepts following parameters: carSpeed: A positive integer from 1 to 10, inclusive. This represents how many spaces each car will move between snapshots. initialState: String between 1 and 50 characters that will represent the initial position of cars as the camera sees them: 'L' represents cars that are moving to the left, 'R' represents cars that are moving to the right, and a '.' represents an empty space. The method will return an array of strings, with characters that show occupied locations at the time of a snapshot. An ‘x’ will indicate a space occupied by one or more cars and a ‘.’ will represent an empty space. Each 'R' and 'L' in the initialState represents one car, but as cars move they can share a space. The last element in the array should show an empty road at the first time when all cars left the view of the camera. */ /* This is the state as viewed from above: V represents the camera, with the open end the direction the camera is pointed. Dashed lines represent the boundaries of the road, R's and L's represent cars. An initialState of ‘..R....’ represents: ------- R ------- V And would project as: '..x....' An initialState of 'R...L' represents: ----- L R ----- V And would project as: 'x...x' Examples input/output (paste this third): Input: carSpeed = 2, initialState = "..R...." Output: [ "..x....", "....x..", "......x", "......." ] Input: carSpeed = 1, initialState = "R...L" Output: [ 'x...x', '.x.x.', '..x..', '.x.x.', 'x...x', '.....' ]
avatar

Senior Backend Engineer

Interviewed at Capsule

3.1
Jul 11, 2021

A high-speed camera is set up at 90 degrees to a segment of road, so it can take snapshots of the road as cars drive past. All cars move with the same speed, but in different directions: some cars move to the right, while others move toward the left. Each car moves in its own lane, so they don’t interfere with each other’s movement. The camera will snapshot positions of cars on the road in a one-dimensional projection. We would like to see the time series of snapshots until the moment when all cars leave the camera view. You need to implement a Snapshot method that accepts following parameters: carSpeed: A positive integer from 1 to 10, inclusive. This represents how many spaces each car will move between snapshots. initialState: String between 1 and 50 characters that will represent the initial position of cars as the camera sees them: 'L' represents cars that are moving to the left, 'R' represents cars that are moving to the right, and a '.' represents an empty space. The method will return an array of strings, with characters that show occupied locations at the time of a snapshot. An ‘x’ will indicate a space occupied by one or more cars and a ‘.’ will represent an empty space. Each 'R' and 'L' in the initialState represents one car, but as cars move they can share a space. The last element in the array should show an empty road at the first time when all cars left the view of the camera. */ /* This is the state as viewed from above: V represents the camera, with the open end the direction the camera is pointed. Dashed lines represent the boundaries of the road, R's and L's represent cars. An initialState of ‘..R....’ represents: ------- R ------- V And would project as: '..x....' An initialState of 'R...L' represents: ----- L R ----- V And would project as: 'x...x' Examples input/output (paste this third): Input: carSpeed = 2, initialState = "..R...." Output: [ "..x....", "....x..", "......x", "......." ] Input: carSpeed = 1, initialState = "R...L" Output: [ 'x...x', '.x.x.', '..x..', '.x.x.', 'x...x', '.....' ]

Design a service to support billions of devices. Problem solving questions. Engineering process questions. Talk with other engineers, product managers, development managers. At the end of the day, I even talked with the founder/co-founder, which helped me a lot to understand more about OfferUp. Eventually helped me to decide which startup offer to take.
Jun 16, 2016

Design a service to support billions of devices. Problem solving questions. Engineering process questions. Talk with other engineers, product managers, development managers. At the end of the day, I even talked with the founder/co-founder, which helped me a lot to understand more about OfferUp. Eventually helped me to decide which startup offer to take.

Viewing 61 - 70 interview questions

Glassdoor has 2,039 interview questions and reports from Senior backend engineer interviews. Prepare for your interview. Get hired. Love your job.