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

Software Developer

Practo
upvote
share-icon
4 rounds | 17 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 months
Topics: Data Structures, Algorithms, DBMS, JavaScript, HTML, CSS, 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: Campus
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
Online Coding Test
Duration90 minutes
Interview date17 Aug 2021
Coding problem3

This round had 3 coding questions of Medium to Hard level of difficulty.

1. Find Intersection of two unsorted arrays.

Easy
0/40
Asked in companies
Expedia GroupMeeshoInfo Edge India (Naukri.com)

You have been given two integer arrays/list(ARR1 and ARR2) of size N and M, respectively. You need to print their intersection; An intersection for this problem can be defined when both the arrays/lists contain a particular value or to put it in other words, when there is a common value that exists in both the arrays/lists.

Note :
Input arrays/lists can contain duplicate elements.

The intersection elements printed would be in the order they appear in the first array/list(ARR1)


Problem approach

Approach 1 (Using Hashing) :

1) Initialize an empty set hs.
2) Iterate through the first array and put every element of the first array in the set S.
3) For every element x of the second array, do the following :
Search x in the set hs. If x is present, then print it.


TC : O(N+M) under the assumption that hash table search and insert operations take O(1) time, here N=size of array
1 and M=size of array 2.
SC : O(min(N,M))



Approach 2 (Using Sorting and Binary Search) :

1) Sort the smaller array.
2) Iterate through the larger array and for every element search if it is present in the smaller array or not using Binary
Search.
3) If the element is present , then print it.


TC : min( O((M+N)*log(M)) , O((M+N)*log(N)) )
SC : O(1)

Try solving now

2. Ways to make Coin Change

Moderate
20m average time
80% success
0/80
Asked in companies
AmazonCIS - Cyber InfrastructureLinkedIn

You are given an infinite supply of coins of each of denominations D = {D0, D1, D2, D3, ...... Dn-1}. You need to figure out the total number of ways W, in which you can make a change for value V using coins of denominations from D. Print 0, if a change isn't possible.

Problem approach

This was a very standard DP problem and I had already solved it on platforms like LeetCode and CodeStudio so I
was able to come up with the logic and code it preety fast.


Steps :

1) Create a two-dimensional array, ‘dp’, where ‘dp[i][j]’ will denote the total number of ways to make j value by using i
coins.

2) Run 2 loops ,1st one from 1 to value and second one throught the array denominations.

3) Fill dp array by the recurrence relation as follows:
ways[i][j] = ways[i-1][j] + ways[i][j-denominations[i]] (if j-denominations[i]>=0)
Where first term represents that we have excluded that coin and,
Second term represents that we have included that coin.

4) Base Case : Fill dp[0]=0 (as we can make 0 amount by giving no coins at all) and the remaining indices with
INT_MAX value

5) Finally , if dp[value]==INT_MAX , return -1 as it is not possible to make "value" using the given coins else return
dp[value] itself


TC : O(N*V) where N=number of coins and V=Value to be made
SC : O(N*V)

Try solving now

3. Longest Substring Without Repeating Characters

Moderate
20m average time
80% success
0/80
Asked in companies
Morgan StanleyAmazonWalmart

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

Approach : I solved it using 2-pointers and keeping a track of the frequency of the elements encountered in a freq
array of size 26.

Steps :

1) Initiliase a freq array of size 26 where a=0, b=1 ...,z=25 .
2) Let s be our string and n = s.size()
3) Do , freq[s[0]]++;
4) Keep 2 pointers start and end where initially start=0 and end=1 also maintain a answer variable ans where initially
ans=0
5) Now run a loop till end=1 and startfreq[s[start]] by 1 every time
7) Update ans by ans=max(ans , end-start+1)
8) Finally return ans


TC : O(N)
SC : O(26)=O(1)

Try solving now
02
Round
Medium
Video Call
Duration60 minutes
Interview date17 Aug 2021
Coding problem5

This round started with 2 coding questions and then moved on to some more questions from OOPS.

1. Palindrome Linked List

Easy
20m average time
90% success
0/40
Asked in companies
Livekeeping (An IndiaMART Company)AppleThought Works

You are given a singly Linked List of integers. Your task is to return true if the given singly linked list is a palindrome otherwise returns false.

For example:
The given linked list is 1 -> 2 -> 3 -> 2-> 1-> NULL.

It is a palindrome linked list because the given linked list has the same order of elements when traversed forwards and backward​.
Follow Up:
Can you solve the problem in O(N) time complexity and O(1) space complexity iteratively?
Problem approach

Approach :

1) Recursively traverse the entire linked list to get the last node as a rightmost node.

2) When we return from the last recursion stack. We will be at the last node of the Linked List. Then the last node
value is compared with the first node value of Linked List.

3) In order to access the first node of Linked List, we create a global left pointer that points to the head of Linked List
initially that will be available for every call of recursion and the right pointer which passes in the function parameter of
recursion.

4) Now, if the left and right pointer node value is matched then return true from the current recursion call. Then the
recursion falls back to (n-2)th node, and then we need a reference to the 2nd node from head. So we advance the left
pointer in the previous call to refer to the next node in the Linked List.

5) If all the recursive calls are returning true, it means the given Linked List is a palindrome else it is not a palindrome.


TC : O(N), where N = number of nodes in the linked list.
SC : O(N)

Try solving now

2. Search an element in a sorted and rotated array

Moderate
30m average time
65% success
0/80
Asked in companies
FreshworksExpedia GroupPayPal

Aahad and Harshit always have fun by solving problems. Harshit took a sorted array consisting of distinct integers and rotated it clockwise by an unknown amount. For example, he took a sorted array = [1, 2, 3, 4, 5] and if he rotates it by 2, then the array becomes: [4, 5, 1, 2, 3].

After rotating a sorted array, Aahad needs to answer Q queries asked by Harshit, each of them is described by one integer Q[i]. which Harshit wanted him to search in the array. For each query, if he found it, he had to shout the index of the number, otherwise, he had to shout -1.

For each query, you have to complete the given method where 'key' denotes Q[i]. If the key exists in the array, return the index of the 'key', otherwise, return -1.

Note:

Can you solve each query in O(logN) ?
Problem approach

This was a preety standard Binary Search Question and I had solved this question before on platforms like LeetCode
and CodeStudio . I was asked this question to test my implementation skills and how well do I handle Edge Cases .

Approach :

1) The idea is to find the pivot point, divide the array in two sub-arrays and perform binary search.

2) The main idea for finding pivot is – for a sorted (in increasing order) and pivoted array, pivot element is the only
element for which next element to it is smaller than it.

3) Using the above statement and binary search pivot can be found.

4) After the pivot is found out divide the array in two sub-arrays.

5) Now the individual sub – arrays are sorted so the element can be searched using Binary Search.


TC : O(Log(N))
SC : O(1)

Try solving now

3. OOPS Question

What is Static variable in C ?

Problem approach

1) Static variables are initialized only once.
2) The compiler persists with the variable till the end of the program.
3) Static variables can be defined inside or outside the function.
4) They are local to the block.
5) The default value of static variables is zero.
6) The static variables are alive till the execution of the program.

Here is the syntax of static variables in C language,

static datatype variable_name = value;

Here,
datatype − The datatype of variable like int, char, float etc.
variable_name − This is the name of variable given by user.
value − Any value to initialize the variable. By default, it is zero.

4. OOPS Question

What is the Difference Between Abstraction and Inheritance?

Problem approach

The main difference between abstraction and inheritance is that abstraction allows hiding the internal details and displaying only the functionality to the users, while inheritance allows using properties and methods of an already existing class.

5. OOPS Question

“Java is not a pure OO language”. Justify this statement.

Problem approach

Java is not fully object oriented because it supports primitive data type like it,byte,long etc.,which are not objects. Because in JAVA we use data types like int, float, double etc which are not object oriented, and of course is what opposite of OOP is. That is why JAVA is not 100% objected oriented.

03
Round
Medium
Video Call
Duration60 minutes
Interview date17 Aug 2021
Coding problem7

This round had questions mainly from HTML,CSS and JavaScript as I had mentioned some Frontend Projects in my resume so the interviewer wanted to check my skills on those. He also asked me some SQL queries and a simple coding question towards the end of the interview.

1. JavaScript Question

What is event bubbling?

Problem approach

Event bubbling is a method of event propagation in the HTML DOM API when an event is in an element inside another element, and both elements have registered a handle to that event. It is a process that starts with the element that triggered the event and then bubbles up to the containing elements in the hierarchy. In event bubbling, the event is first captured and handled by the innermost element and then propagated to outer elements.

 

Syntax : 

addEventListener(type, listener, useCapture)

 

type : Use to refer to the type of event.

listener : Function we want to call when the event of the specified type occurs.

userCapture : Boolean value. Boolean value indicates event phase. By Default useCapture is false. It means it is in the bubbling phase.

2. JavaScript Question

Difference between .on(‘click’) and .click()?

Problem approach

When we use ".click"

$("button.alert").click(function() {
alert(1);
});

with the above, a separate handler gets created for every single element that matches the selector. That means

1) many matching elements would create many identical handlers and thus increase memory footprint

2) dynamically added items won't have the handler - ie, in the above html the newly added "Alert!" buttons won't work unless you rebind the handler.

 

 

When we use ".on"

$("div#container").on('click', 'button.alert', function() {
alert(1);
});

with the above, a single handler for all elements that match your selector, including the ones created dynamically.

 

Using .click() will load an event handler per element into memory. 

Using .on() with delegation is created only one for all elements.

3. HTML Question

How to optimize website assets loading?

Problem approach

To optimize website load time we need to optimize its asset loading and for that:

1) CDN hosting - A CDN or content delivery network is geographically distributed servers to help reduce latency.

2) File compression - This is a method that helps to reduce the size of an asset to reduce the data transfer

3) File concatenation - This reduces the number of HTTP calls

4) Minify scripts - This reduces the overall file size of js and CSS files

5) Parallel downloads - Hosting assets in multiple subdomains can help to bypass the download limit of 6 assets per domain of all modern browsers. This can be configured but most general users never modify these settings.

6) Lazy Loading - Instead of loading all the assets at once, the non-critical assets can be loaded on a need basis.

4. HTML Question

In how many ways you can display HTML elements?

Problem approach

1) inline: Using this we can display any block-level element as an inline element. The height and width attribute values of the element will not affect.

2) block: using this, we can display any inline element as a block-level element. 

3) inline-block: This property is similar to inline, except by using the display as inline-block, we can actually format the element using height and width values.

4) flex: It displays the container and element as a flexible structure. It follows flexbox property.

5) inline-flex: It displays the flex container as an inline element while its content follows the flexbox properties.

6) grid: It displays the HTML elements as a grid container.

7) none: Using this property we can hide the HTML element.

5. SQL Question

Write a SQL query to find all duplicate emails in a table named Person.

+----+---------+
| Id | Email   |
+----+---------+
| 1  | a@b.com |
| 2  | c@d.com |
| 3  | a@b.com |
+----+---------+

 

For example, your query should return the following for the above table:

+---------+
| Email   |
+---------+
| a@b.com |
+---------+
Problem approach

Approach : Using GROUP BY and HAVING condition A more common used way to add a condition to a GROUP BY is to use the HAVING clause, which is much simpler and more efficient.

Query : 

select Email
from Person
group by Email
having count(Email) > 1;

6. SQL Question

Table: Person

+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| PersonId    | int     |
| FirstName   | varchar |
| LastName    | varchar |
+-------------+---------+
PersonId is the primary key column for this table.
Table: Address

+-------------+---------+
| Column Name | Type    |
+-------------+---------+
| AddressId   | int     |
| PersonId    | int     |
| City        | varchar |
| State       | varchar |
+-------------+---------+
AddressId is the primary key column for this table.

 

Write a SQL query for a report that provides the following information for each person in the Person table, regardless if there is an address for each of those people:

FirstName, LastName, City, State

 

 

Problem approach

Approach : Since the PersonId in table Address is the foreign key of table Person, we can join this two table to get the address information of a person. Considering there might not be an address information for every person, we should use outer join instead of the default inner join.

 

Query :

select FirstName, LastName, City, State
from Person left join Address
on Person.PersonId = Address.PersonId ;

7. Check if two strings are anagram of each other

Moderate
30m average time
60% success
0/80
Asked in companies
NearbuyAppleAmerican Express

You are given two strings 'str1' and 'str1'.


You have to tell whether these strings form an anagram pair or not.


The strings form an anagram pair if the letters of one string can be rearranged to form another string.

Pre-requisites:

Anagrams are defined as words or names that can be formed by rearranging the letters of another word. Such as "spar" can be formed by rearranging letters of "rasp". Hence, "spar" and "rasp" are anagrams. 

Other examples include:

'triangle' and 'integral'
'listen' and 'silent'
Note:
Since it is a binary problem, there is no partial marking. Marks will only be awarded if you get all the test cases correct. 
Problem approach

Approach 1(Using Sorting) : 
1) Sort both strings
2) Compare the sorted strings

TC : O(N*log(N)), where N = length of the string
SC : O(1)


Approach 2(Counting characters) : 

1) Create count arrays of size 256 for both strings. Initialize all values in count arrays as 0.
2) Iterate through every character of both strings and increment the count of character in the corresponding count arrays.
3) Compare count arrays. If both count arrays are same, then return true.

TC : O(N), where N = length of the string
SC : O(1)

Try solving now
04
Round
Easy
HR Round
Duration30 minutes
Interview date17 Aug 2021
Coding problem2

This is a cultural fitment testing round. HR was very frank and asked standard questions. Then we discussed about my role.

1. Basic HR Question

Tell me something not there in your resume.

Problem approach

If you get this question, it's an opportunity to choose the most compelling information to share that is not obvious from your resume.

Example :

Strength -> I believe that my greatest strength is the ability to solve problems quickly and efficiently, which makes me unique from others.

Ability to handle Pressure -> I enjoy working under pressure because I believe it helps me grow and become more efficient.


Tip : Emphasize why you were inspired to apply for the job. You can also explain that you are willing to invest a great deal of energy if hired.

These are generally very open ended questions and are asked to test how quick wit a candidate is. So there is nothing to worry about if you have a good command over your communication skills and you are able to propagate your thoughts well to the interviewer.

2. Basic HR Question

Why should we hire you?

Problem approach

Tip 1 : The cross questioning can go intense some time, think before you speak.

Tip 2 : Be open minded and answer whatever you are thinking, in these rounds I feel it is important to have opinion.

Tip 3 : Context of questions can be switched, pay attention to the details. It is okay to ask questions in these round, like what are the projects currently the company is investing, which team you are mentoring. How all is the work environment etc.

Tip 4 : Since everybody in the interview panel is from tech background, here too you can expect some technical questions. No coding in most of the cases but some discussions over the design can surely happen.

Here's your problem of the day

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

Skill covered: Programming

What is recursion?

Choose another skill to practice
Similar interview experiences
Software Developer
4 rounds | 11 problems
Interviewed by Practo
913 views
0 comments
0 upvotes
SDE - 1
4 rounds | 7 problems
Interviewed by Practo
2313 views
0 comments
0 upvotes
SDE - 1
3 rounds | 6 problems
Interviewed by Practo
996 views
0 comments
0 upvotes
SDE - 1
2 rounds | 4 problems
Interviewed by Practo
893 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Developer
5 rounds | 14 problems
Interviewed by Microsoft
3931 views
1 comments
0 upvotes
company logo
Software Developer
6 rounds | 12 problems
Interviewed by SAP Labs
2806 views
0 comments
0 upvotes
company logo
Software Developer
3 rounds | 3 problems
Interviewed by Amazon
1134 views
0 comments
0 upvotes