MAQ Software interview experience Real time questions & tips from candidates to crack your interview

Associate Software Developer

MAQ Software
upvote
share-icon
2 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 3 Months
Topics: DSA, C++, CP, DP, Pointers, OOPS, Java, DBMS, Puzzles
Tip
Tip

Tip 1 : 1D Array and 2D array problems. 
Tip 2 : Puzzle solving
Tip 3 : Your projects.

Application process
Where: Campus
Eligibility: 6.5
Resume Tip
Resume tip

Tip 1 : Projects should be on relevant tech stacks.
Tip 2 : Your achievements should be highlighted.

Interview rounds

01
Round
Easy
Online Coding Interview
Duration90 Minutes
Interview date9 Oct 2020
Coding problem4

4 easy coding problems and 30 mcq's.

1. Merge Two Sorted Linked Lists

Moderate
15m average time
80% success
0/80
Asked in companies
HSBCAmazonApple

You are given two sorted linked lists. You have to merge them to produce a combined sorted linked list. You need to return the head of the final linked list.

Note:

The given linked lists may or may not be null.

For example:

If the first list is: 1 -> 4 -> 5 -> NULL and the second list is: 2 -> 3 -> 5 -> NULL

The final list would be: 1 -> 2 -> 3 -> 4 -> 5 -> 5 -> NULL
Problem approach

Maintain a head and a tail pointer on the merged linked list.

Then choose the head of the merged linked list by comparing the first node of both linked lists.

For all subsequent nodes in both lists, you choose the smaller current node and link it to the tail of the merged list, and moving the current pointer of that list one step forward.

You keep doing this while there are some remaining elements in both the lists.

If there are still some elements in only one of the lists, you link this remaining list to the tail of the merged list.

Initially, the merged linked list is NULL.

Compare the value of the first two nodes and make the node with the smaller value the head node of the merged linked list.

Since it’s the first and only node in the merged list, it will also be the tail.

Then move head1 one step forward.

Try solving now

2. Maximum Depth Of A Binary Tree

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

You are given the root node of a binary tree with N nodes, whose nodes have integer values. Your task is to find the maximum depth of the given Binary tree.

Depth of a binary tree is the same as its height. In simpler terms, you have to find the total number of nodes encountered while moving from the root node to the farthest leaf node, along the longest path of the binary tree.

Example:-

example

If we are given the above binary tree as input then moving from root node(5) to the farthest leaf node(50), the path formed will be [ 5->10->25->35->40->45->50 ]. The total number of nodes encountered is 7, therefore the maximum depth of the binary tree is 7.
Problem approach

Let's redefine the problem:
So, the question says given the root of a binary tree, return the maximum depth of the tree. Max depth means the number of nodes along the longest path from root to farthest leaf node.

Recursion:
Lets have faith in recursion and assume that we are already given the maximum depth of root's left and right subtrees by recursion.
So to find the maximum depth of this binary tree, we will have to take out the maximum of the 2 depths given to us by recursion, and add 1 to that to consider the current level i.e. root's level into our depth.

So basically, to find the maximum depth of the binary tree given, we mainly have to have do

int maxDepthLeft = maxDepth(root->left);
int maxDepthRight = maxDepth(root->right);
return max(maxDepthLeft, maxDepthRight) + 1;
Base Case:
We can easily analyze that if we are at a leaf node as root, then its left and right subtrees will have 0 depth, and consecutively, this leaf node will have max depth of 1.

Try solving now

3. Detect and Remove Loop

Moderate
10m average time
90% success
0/80
Asked in companies
IBMDelhiveryQualcomm

Given a singly linked list, you have to detect the loop and remove the loop from the linked list, if present. You have to make changes in the given linked list itself and return the updated linked list.

Expected Complexity: Try doing it in O(n) time complexity and O(1) space complexity. Here, n is the number of nodes in the linked list.

Problem approach

Floyd’s Cycle-Finding Algorithm // fast slow approach // 2 pointers // "tortoise and the hare algorithm"

Approach: This is the fastest method and has been described below:

Traverse linked list using two pointers.

Move one pointer(slow_p) by one and another pointer(fast_p) by two.

If these pointers meet at the same node then there is a loop. If pointers do not meet then linked list doesn’t have a loop.

Try solving now

4. Reverse Linked List

Easy
15m average time
85% success
0/40
Asked in companies
Citi BankDelhiverySprinklr
Note :
You do not need to print anything, just return the head of the reversed linked list. 
Problem approach

If Head is null,then there's No Linked list to reverse, return null or head itself.

After reversing the linked list, Last Node must point to null ptr.
till tempNode reach to the last Node and traverse the whole linkedlist.
store the address of the next node to traverse
reverse the direction of the link arrows
store the address of the present temp node into prev
now move the ptr(tempNode) to the next Node.
after reversing Last Node is the first one and behave like a head Node

Try solving now
02
Round
Medium
Video Call
Duration60 Minutes
Interview date23 Oct 2020
Coding problem2

Questions from oops, programming, projects, puzzle solving.

1. Puzzle

We have two water jugs, one measures 4 Gallons (4G) while the other measure 9 Gallons (9G). But there is no measuring label mentioned on either of these two jugs i.e. we cannot know the exact amount filled in the jug. Now, assuming there is an infinite amount of water supply, can we measure all 1G, 2G, 3G…….. upto 9G using these unmarked jugs.

Problem approach

Tip 1: Practice a lot on different platforms
Tip 2: use stopwatch to measure your speed.

2. Spiral Matrix

Easy
0/40
Asked in companies
GE (General Electric)AmazonSalesforce

You are given a N x M matrix of integers, return the spiral path of the matrix

Example Of Spiral Path

Spiral Path

Problem approach

- set k = 0, l = 0
set m = n, value = 1
initialize 2D result as vector>

/*
k - starting row index
m - ending row index
l - starting column index
n - ending column index
i - iterator
*/

- loop while k < m && l < n
- loop for i = l; i < n; i++
- set result[k][i] = value
- increment value++
- k++

- loop for i = k; i < m; i++
- set result[i][n - 1] = value
- increment value++
- n--

- loop for i = n - 1; i >= l; i--
- set result[m - 1][i] = value
- increment value++
- m--

- loop for i = m - 1; i >= k; i--
- set result[i][l] = value
- increment value++
- l++

- return result

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
Software Engineer
3 rounds | 2 problems
Interviewed by MAQ Software
1421 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by MAQ Software
1040 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by MAQ Software
0 views
0 comments
0 upvotes
company logo
SE-1
2 rounds | 4 problems
Interviewed by MAQ Software
18 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Associate Software Developer
3 rounds | 7 problems
Interviewed by CIS - Cyber Infrastructure
592 views
0 comments
0 upvotes