Housing.com interview experience Real time questions & tips from candidates to crack your interview

Software Engineer

Housing.com
upvote
share-icon
3 rounds | 5 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 months
Topics: Data Structures, Algorithms, System Design, Aptitude, OOPS
Tip
Tip

Tip 1 : Must do Previously asked Interview as well as Online Test Questions.
Tip 2 : Go through all the previous interview experiences from Codestudio and Leetcode.
Tip 3 : Do at-least 2 good projects and you must know every bit of them.

Application process
Where: Referral
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Make a cv which is appealing, and highlight some key things regarding web development or algorithms or system development. 
Tip 2 : Have at-least 2 good projects explained in short with all important points covered.

Interview rounds

01
Round
Easy
Face to Face
Duration60 minutes
Interview date15 May 2015
Coding problem1

Resume based and 1 coding question. Briefly discussed about projects in resume and questions were completely related to projects mentioned.

1. Find Duplicate in Array

Easy
15m average time
85% success
0/40
Asked in companies
BNY MellonIBMOla

You are given an array of integers 'ARR' containing N elements. Each integer is in the range [1, N-1], with exactly one element repeated in the array.

Your task is to find the duplicate element. The duplicate element may be repeated more than twice in the error, but there will be exactly one element that is repeated in the array.

Note :

All the integers in the array appear only once except for precisely one integer which appears two or more times.
Problem approach

Concept of indexing can be used to solve this question.
Traverse the array. For every element at index i,visit a[i]. If a[i] is positive, then change it to negative. If a[i] is negative, it means the element has already been visited and thus it is repeated. Print that element.
Pseudocode :
findRepeating(arr[], n)
{
missingElement = 0

for (i = 0; i < n; i++){
element = arr[abs(arr[i])]

if(element < 0){
missingElement = arr[i]
break
}

arr[abs(arr[i])] = -arr[abs(arr[i])]
}
return abs(missingElement)
}

Try solving now
02
Round
Medium
Face to Face
Duration60 minutes
Interview date18 May 2015
Coding problem3

This round was completely pen and paper coding round. 3 coding questions were asked.

1. Sum root to leaf

Easy
10m average time
90% success
0/40
Asked in companies
MicrosoftUnacademyMorgan Stanley

You are given an arbitrary binary tree consisting of N nodes where each node is associated with a certain integer value from 1 to 9. Consider each root to leaf path as a number.

For example:

       1
      /  \
     2    3

The root to leaf path 1->2 represents the number 12.
The root to leaf path 1->3 represents the number 13.

Your task is to find the total sum of all the possible root to leaf paths.

In the above example,

The total sum of all the possible root to leaf paths is 12+13 = 25
Note:
The output may be very large, return the answer after taking modulus with (10^9+7).
Problem approach

This can be solved using recursion. The basic idea is to subtract the value of current node from sum until it reaches a leaf node and the subtraction equals 0, then we know that we got a hit. Keep checking for left or right child path sum equal to target sum – value at current node.
Time Complexity : O(N)

Try solving now

2. Largest subarray with equal number of 0s and 1s

Moderate
10m average time
85% success
0/80
Asked in companies
OraclePhonePeSAP Labs

You are given an array consisting of 0s and 1s. You need to find the length of the largest subarray with an equal number of 0s and 1s.

For example:

If the given array is: [0, 0, 1, 0, 1] The largest subarray would be: [0, 1, 0, 1] (last 4 elements) having length 4.
Problem approach

The brute force approach would be to consider every possible subarray within the given array and count the number of zeros and ones in each subarray. Then, find out the maximum size subarray with equal no. of zeros and ones out of them.

Time Complexity: O(N^2)

To optimise the above approach, the concept of hashing can be used. If we consider 1 in array to be +1 and 0 to be -1, and while traversing the array maintain a variable called currSum that stores the sum of array elements upto i elements. A subarray can contains equal no. of 0 and 1 if its currSum is 0 or currSum in already encountered in the array before.

Algorithm:
Maintain a hahmap mp such that mp[currSum]=length of [0......i] whose sum=currSum
int sum=0
For 0 , do -1 from currSum and for 1, do +1 to currSum
Then there will be 3 cases:
case 1:
if(currSum==0){ //No of ones and zeroes in [0.....i] are equal so update the max length
case 2:
currSum already exist in map,
let for range [(0.....j)(......i)] sum of range[0....j] =sum of range [j+1....i]=> current range , it means No of zeroes and ones in the range [j+1.....i] are equal because total sum throughout this range didn't change
here mp[currSum]=length of interval [0.....j] so update the max length till now
case 3:
currSum did not exist earlier and neither equal to 0, so store this sum in map by its length

Try solving now

3. The Skyline Problem

Hard
15m average time
85% success
0/120
Asked in companies
UberAppleSamsung R&D Institute

You are given 'N' rectangular buildings in a 2-dimensional city. Your task is to compute the skyline of these buildings, eliminating hidden lines return the skyline formed by these buildings collectively. A city's skyline is the outer contour of the silhouette formed by all the buildings in that city when viewed from a distance. The geometric information of each building is given in the array of buildings where BUILDINGS[i] = [LEFT_i, RIGHT_i, HEIGHT_i]:

-> LEFT_i is the x coordinate of the left edge of the ith building.

-> RIGHT_i is the x coordinate of the right edge of the ith building.

-> HEIGHT_i is the height of the ith building.

You may assume all buildings are perfect rectangles grounded on an absolutely flat surface at height 0.

The skyline should be represented as a list of "key points" sorted by their x-coordinate in the form [[x1, y1], [x2, y2], ...]. Each key point is the left endpoint of some horizontal segment in the skyline except the last point in the list, which always has a y-coordinate 0 and is used to mark the skyline's termination where the rightmost building ends. Any ground between the leftmost and rightmost buildings should be part of the skyline's contour.

Note:
There must be no consecutive horizontal lines of equal height in the output skyline. For instance, [...,[2 3], [4 5], [7 5], [11 5], [12 7],...] is not acceptable; the three lines of height 5 should be merged into one in the final output.

As such: [..., [2 3], [4 5], [12 7],...]. 

Also, the buildings are sorted by a non-decreasing order.

For more clarification see sample case 1.
Problem approach

The idea here is to first, sort the critical POINTS with respect to their coordinate and height pairs. Make a pair of 'X1' and take a negative of the height for the building so that 'X1' pairs are sorted before 'X2' pairs. Create a dictionary keeping the heights as keys and as soon as a left edge of a building is encountered, we add that building to the dictionary with its height as the key. When we encounter the right edge of a building, we remove that from the dictionary. When you hit the left edge of a building you add it to the dictionary, and when you hit the right edge of a building you delete the key. Finally, any time we encounter a critical point, after updating the dictionary we find the height of that critical point with maximum height value from keys that we already have in the dictionary to the value peeked from the top of the heap.

 

The algorithm will be-

  1. Store the coordinates and heights of the buildings paired up with each other with the first building coordinate paired after taking negative of the height and the second coordinate with positive height in a list ‘POINTS’.
  2. Now, sort edges present in the ‘POINTS’ list (array) in ascending order.
  3. The positions are now sorted from left to right, small to large. Now, initialise a dictionary named 'HEIGHTS' with zero as its first key, having a value of 1 since this would be the last height that would be added.
  4. Now, for each pair of an edge in the ‘POINTS’ list (array) and check:
    1. Update the dictionary if the current edge is a start edge (with negative height) increment the value of the key by 1.
    2. Delete the invalid buildings from the dictionary if an end edge is encountered for a key after decrementing its value by 1.
    3. Now, In each iteration update the 'SKYLINE', which records the highest building from some position, and add it to the final list of our 'SKYLINE's if the current highest is no longer the tail of the 'SKYLINE' (previous highest).
  5. We finally return the 'SKYLINE' list (array) that we have formed.
Try solving now
03
Round
Easy
Face to Face
Duration20 minutes
Interview date18 May 2015
Coding problem1

Only one coding question was asked with time limit of 10 minutes

1. Word Break-1

Hard
36m average time
55% success
0/120
Asked in companies
IBMAmazonMicrosoft

You are given a string 's', and a dictionary of words 'dict' containing 'n' words. Your task is to add spaces in 's' to form valid sentences, where each word is a word from the dictionary.


You need to return all possible sentences that can be formed using the given dictionary.


Note :
The same word from a dictionary can be used as many times as possible to make sentences.
Problem approach

Hashing can be used to solve this question. Keep the count of words of the dictionary in a hash map. Iterate the string and for each word, check if is present in the map. If present, then decrease the count of that word in the map. If it is not present, then it is not possible to make the given string from the given dictionary of words.

Try solving now

Here's your problem of the day

Solving this problem will increase your chance to get selected in this company

Skill covered: Programming

How do you remove whitespace from the start of a string?

Choose another skill to practice
Similar interview experiences
company logo
Frontend Engineer
3 rounds | 8 problems
Interviewed by Housing.com
1436 views
0 comments
0 upvotes
company logo
Software Engineer
3 rounds | 8 problems
Interviewed by Housing.com
1508 views
0 comments
0 upvotes
company logo
Software Engineer
4 rounds | 12 problems
Interviewed by Housing.com
1469 views
0 comments
0 upvotes
company logo
SDE - Intern
2 rounds | 4 problems
Interviewed by Housing.com
1307 views
1 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Engineer
3 rounds | 7 problems
Interviewed by Optum
7976 views
1 comments
0 upvotes
company logo
Software Engineer
5 rounds | 5 problems
Interviewed by Microsoft
10148 views
1 comments
0 upvotes
company logo
Software Engineer
2 rounds | 4 problems
Interviewed by Amazon
4448 views
1 comments
0 upvotes