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

Software Developer

Housing.com
upvote
share-icon
3 rounds | 7 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: Other
Eligibility: Above 7 CGPA
Resume Tip
Resume tip

Tip 1 : Have at-least 2 good projects explained in short with all important points covered.
Tip 2 : Every skill must be mentioned.
Tip 3 : Focus on skills, projects and experiences more.

Interview rounds

01
Round
Medium
Face to Face
Duration60 minutes
Interview date11 May 2015
Coding problem3

Technical round with questions based on DSA.

1. Maximum level sum

Easy
15m average time
80% success
0/40
Asked in companies
OYOAmazonHSBC

Given a Binary Tree with integer nodes, your task is to find the maximum level sum among all the levels in the Binary Tree. The sum of any level in a tree is the sum of all the nodes present at that level.

Problem approach

This question can be solved by doing a level order traversal of the tree. While doing the traversal, process nodes of different levels separately. For every level being processed, calculate the sum of nodes in each level and keep track of the maximum sum. At the end, return the maximum sum. 
Time Complexity: O(N)
Auxiliary Space: O(w) where w is the maximum width of the tree

Try solving now

2. Maximum Sum Circular Subarray

Moderate
10m average time
90% success
0/80
Asked in companies
UberalibabaHousing.com

You have been given a circular array/list ‘ARR’ containing ‘N’ integers. You have to find out the maximum possible sum of a non-empty subarray of ‘ARR’.

A circular array is an array/list in which the end of the array connects to the beginning of the array.

A subarray may only include each element of the fixed buffer of ‘ARR’ at most once. (Formally, for a subarray ‘ARR[i]’, ‘ARR[i+1]’, ..., ‘ARR[j]’, there does not exist ‘i’ <= ‘k1’, ‘k2’ <= ‘j’ with ‘k1’ % ‘N’ = k2 % ‘N’.)

For Example:

The ‘ARR’ = [1, 2, -3, -4, 5], the subarray [5, 1, 2] has the maximum possible sum which is 8. This is possible as 5 is connected to 1 because ‘ARR’ is a circular array.
Problem approach

A modified Kadane’s algorithm can be used for this problem. Using kadane’s, find the minimum contiguous subarray sum and the maximum contiguous subarray sum in the array and then check for the maximum value between the max_value and the value left after subtracting min_value from the total sum. 
Example 1:-
A = [1, -2, 3, -2]
Max_value = 3 (This means max subarray sum for normal array)
Min_value = -2 (This means min subarray sum for normal array)
Total_sum = 0 (total array sum)
Maximum Sum = 3 (max)

Example 2 :-
A = [5, -3, 5]
Max_value = 7
Min_value = -3
Total_sum = 7
maximum subarray sum = 7 - (-3) = 10

Algorithm :
1. Find maximum subarray sum using kadane's algorithm (max_value) 
2. Find minimum subarray sum using kadane's algorithm (min_value)
3. Find total sum of the array (total_sum). 
4. Now, if total_sum == min_value i.e. all values are negative, return max_value
5. Otherwise, return maximum ( max_value, total_sum – min_value )

Time Complexity: O(N)
Auxiliary Space: O(1)

Try solving now

3. Sum of Big integers.

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

You have been given two integers ‘NUM1’ and ‘NUM2’ as a string. Your task is to print the sum of both the numbers.

Problem approach

Since the numbers are large, we store the numbers in string type. To add the two numbers, basic school mathematics can be applied. 
Traverse both the strings from end, one by one add digits and keep track of carry. 
Steps : 
1) Reverse both strings. 
2) Keep adding digits one by one from 0’th index (in reversed strings) to end of smaller string, append the sum % 10 to end of result and keep track of carry as sum/10. 
3) Finally reverse the resultant string.

Try solving now
02
Round
Easy
Face to Face
Duration60 minutes
Interview date11 May 2015
Coding problem2

Briefly discussed about projects in resume and questions were completely related to projects mentioned. And then he asked questions based on DSA.

1. Longest Substring Without Repeating Characters

Moderate
20m average time
80% success
0/80
Asked in companies
AmazonInfo Edge India (Naukri.com)Oracle

Given a string 'S' of length 'L', return the length of the longest substring without repeating characters.

Example:

Suppose given input is "abacb", then the length of the longest substring without repeating characters will be 3 ("acb").
Problem approach

The brute force approach would be to consider all substrings one by one and check for each substring whether it contains all unique characters or not. There will be n*(n+1)/2 substrings. Time complexity of this solution would be O(n^3).

For an efficient solution, a hashmap can be used. Maintain a hashmap which stores the characters in string as keys and their indexes(positions) as values, and keep two pointers which define the max substring. move the right pointer to traverse through the string, and meanwhile update the hashmap. If the character is already in the hashmap, then move the left pointer to the right of the same character last found. Keep updating the max length Non-Repeating Character Substring seen so far.

Try solving now

2. 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
03
Round
Easy
Face to Face
Duration60 minutes
Interview date11 May 2015
Coding problem2

Technical round where the interviewer asked me 2 DSA problems.

1. Replace Spaces

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

You have been given a string 'STR' of words. You need to replace all the spaces between words with “@40”.

Problem approach

One approach could be to calculate the number of spaces in the given string. Calculate the new length of the string as original length + 2*(number of spaces). Create a new string of the length calculated. Traverse the original string and keep appending all characters except spaces in the new string. As soon as a space is encountered, append '%20' in the string. Return the new string created.

Try solving now

2. Painter's Partition Problem

Moderate
25m average time
75% success
0/80
Asked in companies
OYOHSBCPayPal

Given an array/list of length ‘n’, where the array/list represents the boards and each element of the given array/list represents the length of each board. Some ‘k’ numbers of painters are available to paint these boards. Consider that each unit of a board takes 1 unit of time to paint.


You are supposed to return the area of the minimum time to get this job done of painting all the ‘n’ boards under a constraint that any painter will only paint the continuous sections of boards.


Example :
Input: arr = [2, 1, 5, 6, 2, 3], k = 2

Output: 11

Explanation:
First painter can paint boards 1 to 3 in 8 units of time and the second painter can paint boards 4-6 in 11 units of time. Thus both painters will paint all the boards in max(8,11) = 11 units of time. It can be shown that all the boards can't be painted in less than 11 units of time.


Problem approach

Firstly, we calculate the sum of all the elements in the array. If the sum is odd (sum%2!=0), then we cannot divide the array elements into 2 subsets with equal sum, but if the sum is even, we might be able to divide the array into 2 equal subsets. If the sum is even, we check if there is a subset with the sum of elements = sum/2. If it exists, that means the other subset also has elements with sum = sum/2, so we return true. If we're not able to find any such subset, we finally return false.
Now, we need to find approach to find subset with sum/2. 
The brute force approach would be to use recursion. We can consider each item in the given array one by one. For each item, there are two possibilities:
• We can find a subset with sum/2 which includes the current element, so we include the current item in the subset and recur for remaining items with the remaining sum (sum - array[index]).
• We cannot find a subset with sum/2 with the current index value included. So, we exclude the current item from the subset and recur for remaining items.
Time Complexity of this approach would be O(2^n). 
• Dynamic programming can be used to optimize this. Bottom up approach can be used to compute dp[i][j]. dp[i][j] means whether the specific sum j can be gotten from the first i numbers. If we can pick such a series of numbers from 0-i whose sum is j, dp[i][j] is true, otherwise it is false.
• dp[i][j] is true if dp[i-1][j] is true (meaning that we skipped this element, and took the sum of the previous result) or dp[i-1][j-array[i]], i.e we're searching for a subset with sum = sum - array[i].
• If dp[n][sum/2] is true that means we were able to find a sum of sum/2 out of n elements which is what we want to check.
Time Complexity : O(nxsum/2)

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
Devops Engineer
2 rounds | 7 problems
Interviewed by Housing.com
1451 views
0 comments
0 upvotes
company logo
Software Engineer
4 rounds | 12 problems
Interviewed by Housing.com
1470 views
0 comments
0 upvotes
company logo
Lead Software Engineer
4 rounds | 4 problems
Interviewed by Housing.com
1250 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
3502 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Developer
5 rounds | 14 problems
Interviewed by Microsoft
4029 views
1 comments
0 upvotes
company logo
Software Developer
6 rounds | 12 problems
Interviewed by SAP Labs
2912 views
0 comments
0 upvotes
company logo
Software Developer
3 rounds | 3 problems
Interviewed by Amazon
1270 views
0 comments
0 upvotes