Directi
Bix Bytes Solutions GmbH Interview Questions and Answers
Q1. 2)Given an n x n matrix, where every row and column is sorted in increasing order. Given a number x, how to decide whether this x is in the matrix. The designed algorithm should have linear time complexity. a) ...
read moreAlgorithm to find if a number is present in a sorted n x n matrix with linear time complexity.
Start with the top right element
Compare the element with x
If equal, return its position
If e < x, move down (if out of bounds, return false)
If e > x, move left (if out of bounds, return false)
Repeat till element is found or returned false
Q2. 4)Given a set of integers, Display the non-empty subsets whose sum is zero. For example, given the set { −7, −3, −2, 5, 8}, the answer is the subset { −3, −2, 5} which sums to zero. This is the special case of ...
read moreThe problem is to find non-empty subsets of a given set of integers whose sum is zero.
The problem is a special case of the knapsack problem and is known to be NP-Complete.
A brute-force approach would involve generating all subsets and checking their sums.
The brute-force approach has an exponential time complexity.
There is no known polynomial time solution for this problem.
Q3. Sub Divide a Rectangle. Given a Rectangle of M X N. U have many smaller rectangles of M1 X N1 and so on. You have to divide the greater rectangle in such a way to minimize the wastage. Rules of division are, ev...
read moreDivide a rectangle of M x N into smaller rectangles of M1 x N1 to minimize wastage.
Start by dividing the rectangle horizontally or vertically based on the dimensions of the smaller rectangles.
Continue dividing each resulting sub-rectangle until no further division is possible.
Consider the dimensions of the smaller rectangles and the remaining space to minimize wastage.
Keep track of the divisions made to reconstruct the original rectangle if needed.
Q4. Beer overflow problem. Glasses are stacked like a pyramid onto a table. If you are given X liters of water to pour on the topmost glass, How much water will be held by each glass. Given, Xth glass an hold x lit...
read moreThe glasses are stacked like a pyramid on a table. Each glass can hold a certain amount of water, and the overflow is distributed equally to the glasses below.
The glasses form a pyramid shape, with the topmost glass being the first level and each subsequent level having one more glass than the previous level.
The amount of water held by each glass can be calculated by dividing the total amount of water by the number of glasses in that level.
For example, if there are 10 glasses...read more
Q5. 5)Create a data structure where inserting, deleting and finding the minimum element all have O(1) time. i said we can use augmented stack where with each element we can augment the minimum element along with it...
read moreData structure with O(1) insert, delete, and find min without creating new structures
Use two stacks, one for actual data and one for minimum values
When inserting, push the value onto the data stack and push the minimum of the new value and the top of the minimum stack onto the minimum stack
When deleting, pop from both stacks
When finding the minimum, return the top of the minimum stack
Q6. You start with A. In every step, A gets transformed to AB and B get transformed to BA. You are supposed to tell how many ‘BB’ will occur at Nth iteration. E.G. A AB ABBA ABBABAAB … So on
The number of 'BB' occurrences at the Nth iteration of the transformation sequence.
At each iteration, A gets transformed to AB and B gets transformed to BA.
To find the number of 'BB' occurrences at the Nth iteration, we need to count the number of 'BB' substrings in the transformed string.
The transformation sequence follows a pattern: AB, ABA, ABAAB, ABAABABA, ...
The number of 'BB' occurrences doubles with each iteration: 0, 0, 1, 2, 4, 8, 16, ...
To calculate the number of 'B...read more
Q7. 1)There are three types of balls arranged linearly in a random order Red, Green and Blue. Now your job is to sort them so that the Red balls are in front follwed by the Green balls and the Blue balls are pushed...
read moreSorting an array of 0, 1 and 2 can be done in O(n) using two pointers.
Use two pointers, one for 0 and one for 2, and a current pointer to traverse the array
If the current pointer encounters a 0, swap it with the 0 pointer and move both pointers to the right
If the current pointer encounters a 2, swap it with the 2 pointer and move the 2 pointer to the left
Repeat until the current pointer meets the 2 pointer
Top Software Engineer Interview Questions from Similar Companies
Reviews
Interviews
Salaries
Users/Month