The first round was Online Assessment which was conducted on InterviewBit platform, it was unproctored, there were three questions to solve, one was of Segment tree. Very few people from the college were able to solve it. I solved two questions
Then came the interview where they asked me questions related to CS fundamentals mainly DBMS and OS, and then I was given a Segment tree question on range queries similar to the one in that of CSES sheet, and the second round was mainly projects discussion round and kind of a System Design round
There are n cities arranged in a straight line. Each city contains x warehouses, where the capacity of the i-th warehouse is 2^(i-1) units of goods. Initially, all warehouses in every city are empty.
You are given q operations, each of one of the following two types:
i j g Add g goods to every city in the range [i, j] (inclusive).
t Add the minimum number of goods to city t such that the number of completely filled warehouses in that city remains unchanged compared to before the operation.
A warehouse is considered completely filled only when it holds exactly its capacity.
If it is impossible to perform such an addition, output -1.
You must process all queries in order. For each operation of type 2, output the number of goods added (or -1). After all queries, print the final number of goods in each city.
Input format
The first line contains three integers n, x, and q — the number of cities, the number of warehouses per city, and the number of operations.
The next q lines each describe one operation in the formats given above.
Output format
For every operation of type 2, print the number of goods added (or -1) on a separate line.
After all operations, print a single line with n integers — the final amount of goods in each city.
Example
Input
3 3 5 1 1 2 5 2 2 1 2 3 4 2 3 2 1
Output
3 -1 1 9 9 4
The following metrics were computed from 1 interview experience for the Media.net Software Development Engineer Intern role in Bengaluru, India.
Media.net's interview process for their Software Development Engineer Intern roles in Bengaluru, India is extremely selective, failing the vast majority of engineers.
Candidates reported having mixed feelings for Media.net's Software Development Engineer Intern interview process in Bengaluru, India.