Developer Advisor Interview Questions

711,093 developer advisor interview questions shared by candidates

You are in charge of a classroom which has n seats in a single row, numbered 0 through n-1. During the day students enter and leave the classroom for the exam. In order to minimize the cheating, your task is to efficiently seat all incoming students. You're given 2 types of queries: add_student(student_id) -> seat index, and remove_student(student_id) -> void. The rules for seating the student is the following: 1) The seat must be unoccupied 2) The closest student must be as far away as possible 3) Ties can be resolved by choosing the lowest-numbered seat.
avatar

Software Engineer

Interviewed at Quora, Inc.

4.1
May 27, 2017

You are in charge of a classroom which has n seats in a single row, numbered 0 through n-1. During the day students enter and leave the classroom for the exam. In order to minimize the cheating, your task is to efficiently seat all incoming students. You're given 2 types of queries: add_student(student_id) -> seat index, and remove_student(student_id) -> void. The rules for seating the student is the following: 1) The seat must be unoccupied 2) The closest student must be as far away as possible 3) Ties can be resolved by choosing the lowest-numbered seat.

Viewing 1841 - 1850 interview questions

Glassdoor has 711,093 interview questions and reports from Developer advisor interviews. Prepare for your interview. Get hired. Love your job.