## Recent Interview Questions

More Questions »- 0of 0 votes
Suppose you have a incoming stream of numbers and a method like T* readNextNumber() to read them, and each time there is only limited amont of them coming in and readNextNumber would return null if no more available. implement a method to calculate the median of all numbers you have read.

The key point to the question is figure out the data structure to store those numbers you have read and I stopped at a balance tree, the interviewer told me it should be 2 heaps, one ascending and one descending, plus a median value between them. The final algorithm I figure out based on it is each time compare the new number with median, if bigger than it insert to the descending heap at the right side of the median else to the left, recalculate the median by checking heap sizes, the new median would be either current median, max of the left heap or min of the right heap.

- 0of 2 votes
You have given an array and you want to find an integer k so that the sum of the distances from k to each of the n integers is minimized. Define distance between two integers a and b as |a−b|3.

- 0of 0 votes
Given an array of positive integers(>0) , you have to insert '+','*','(',')' signs basically plus multiply and brackets such that value of resultant expression becomes maximum.

Hint: Consider case of continuous ones

You have to print the resulting expression

- 0of 0 votes
You are given a vector of strings. They have some encoded information regarding location of a hostage. You know that each location in encoded message starts with _123 and ends with _dad. You have to find all such unique enocded locations in the text.

I want to use regex to find the solution to this problem in C++. Can someone provide code for the same.

- 0of 0 votes
Given an array consisting of N Numbers.

Divide it into two Equal(it is important) partitions (in size both contains N/2 elements) such that difference between sum of both partitions is minimum.

If number of elements are odd difference in partition size can be at most 1.