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.
Softwareentwickler Java Interview Questions
512,884 softwareentwickler java interview questions shared by candidates
Write codes for the Nth Fibonacci number.
From an arbitrary list of integers, find all pairs that equal zero.
Given a nested list of integers, return the sum of all integers in the list weighted by their depth For example, given the list {{1,1},2,{1,1}} the function should return 10 (four 1's at depth 2, one 2 at depth 1)
All questions are already on glass door. Just make a list of all the questions and answer them.
Given an array of integers, write a function that will produce a random permutation of the input array.
Given a large document and a short pattern consisting of a few words (eg. W1 W2 W3), find the shortest string that has all the words in any order (for eg. W2 foo bar dog W1 cat W3 -- is a valid pattern)
Given a single-line text string and a maximum width value, write the function 'string justify(string text, int maxWidth)' that formats the input text using full-justification, i.e., extra spaces on each line are equally distributed between the words; the first word on each line is flushed left and the last word on each line is flushed right.
Find indices start and end for a particular value in a sorted integer array with duplicates
What are the steps to connect to a database?
Viewing 1601 - 1610 interview questions