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

Software Engineer

GeeksforGeeks
upvote
share-icon
4 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 12 Months
Topics: data structures, oops, java, dbms, recursion
Tip
Tip

Tip 1 : Make notes of your preparation topics
Tip 2 : Make resume properly
Tip 3 : Cover the majority of topics

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

Tip 1 : Highlight the tech stack used in the projects
Tip 2 : Use single page resume

Interview rounds

01
Round
Easy
Telephonic
Duration60 minutes
Interview date5 Jan 2022
Coding problem2

1. Check Permutation

Easy
0/40
Asked in companies
GeeksforGeeksAdobeOracle

For a given two strings, 'str1' and 'str2', check whether they are a permutation of each other or not.

Permutations of each other
Two strings are said to be a permutation of each other when either of the string's characters can be rearranged so that it becomes identical to the other one.

Example: 
str1= "sinrtg" 
str2 = "string"

The character of the first string(str1) can be rearranged to form str2 and hence we can say that the given strings are a permutation of each other.
Problem approach

-Sort both strings
-Compare the sorted strings

Try solving now

2. Longest Palindromic Substring

Moderate
20m average time
80% success
0/80
Asked in companies
AccentureBig BasketMathworks

You are given a string 'str' of length 'N'.


Your task is to return the longest palindromic substring. If there are multiple strings, return any.


A substring is a contiguous segment of a string.


For example :
str = "ababc"

The longest palindromic substring of "ababc" is "aba", since "aba" is a palindrome and it is the longest substring of length 3 which is a palindrome. 

There is another palindromic substring of length 3 is "bab". Since starting index of "aba" is less than "bab", so "aba" is the answer.
Problem approach

-pick all possible starting and ending positions for a substring
-verify if it is a palindrome

Try solving now
02
Round
Medium
Face to Face
Duration60 minutes
Interview date7 Jan 2022
Coding problem2

1. Range Sum

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

You are given an array ‘arr’ of size ‘N’. You are provided with ‘Q’ queries, each containing two integers, ‘L’ and ‘R’. Your task is to return the sum of elements from the position ‘L’ to ‘R’ for each query.

For example:
You are given arr = [1, 3, 4, 5, 6, 9], and queries = [[1, 3], [5, 6] , [1, 6]].

For the first query [1, 3] sum of elements = 1 + 3 + 4 = 8. Hence the answer is 8

For the second query [5, 6] sum of elements = 6 + 9 = 15. Hence the answer is 15

For the third query [1, 6] sum of elements = 1 + 3 + 4 + 5 + 6 + 9= 28. Hence the answer is 28. 

Hence the final answer is [8, 15, 28]
Problem approach

-A Simple Solution is to compute the sum for every query.

-An Efficient Solution is to precompute prefix sum. Let pre[i] stores sum of elements from arr[0] to arr[i]. To answer a query (i, j), we return pre[j] – pre[i-1].

Try solving now

2. Validate BST

Moderate
25m average time
0/80
Asked in companies
FacebookAmazonFreshworks

You have been given a binary tree of integers with N number of nodes. Your task is to check if that input tree is a BST (Binary Search Tree) or not.

A binary search tree (BST) is a binary tree data structure which has the following properties.

• The left subtree of a node contains only nodes with data less than the node’s data.
• The right subtree of a node contains only nodes with data greater than the node’s data.
• Both the left and right subtrees must also be binary search trees.
Example :

BST1

Answer :

Level 1: 

All the nodes in the left subtree of 4 (2, 1, 3) are smaller 
than 4, all the nodes in the right subtree of the 4 (5) are 
larger than 4.

Level 2 :

For node 2:
All the nodes in the left subtree of 2 (1) are smaller than 
2, all the nodes in the right subtree of the 2 (3) are larger than 2.
For node 5:
The left and right subtrees for node 5 are empty.

Level 3:

For node 1:
The left and right subtrees for node 1 are empty.
For node 3:
The left and right subtrees for node 3 are empty.

Because all the nodes follow the property of a binary search tree, the above tree is a binary search tree.
Problem approach

For each node, check if max value in left subtree is smaller than the node and min value in right subtree greater than the node.

Try solving now
03
Round
Easy
Face to Face
Duration45 minutes
Interview date10 Jan 2022
Coding problem1

1. Minimum Characters For Palindrome

Hard
20m average time
70% success
0/120
Asked in companies
BarclaysFlipkartMicrosoft

Given a string STR of length N. The task is to return the count of minimum characters to be added at front to make the string a palindrome.

For example, for the given string “deed”, the string is already a palindrome, thus, minimum characters needed are 0.

Similarly, for the given string “aabaaca”, the minimum characters needed are 2 i.e. ‘a’ and ‘c’ which makes the string “acaabaaca” palindrome.

Problem approach

We can solve this problem efficiently in O(n) time using lps array of KMP algorithm. 
First we concat string by concatenating given string, a special character and reverse of given string then we will get lps array for this concatenated string, recall that each index of lps array represent longest proper prefix which is also suffix. We can use this lps array for solving the problem. 


For string = AACECAAAA
Concatenated String = AACECAAAA$AAAACECAA
LPS array will be {0, 1, 0, 0, 0, 1, 2, 2, 2, 
0, 1, 2, 2, 2, 3, 4, 5, 6, 7}
Here we are only interested in the last value of this lps array because it shows us the largest suffix of the reversed string that matches the prefix of the original string i.e these many characters already satisfy the palindrome property. Finally minimum number of character needed to make the string a palindrome is length of the input string minus last entry of our lps array. Please see below code for better understanding

Try solving now
04
Round
Easy
Face to Face
Duration30 minutes
Interview date11 Jan 2022
Coding problem1

He asked me to convert a React code to html by taking it as string and converting this string to a string that follows html design patterns. I gave him the approach, then he told me to code it as well. I coded it, then modified, again modified. And lastly, I had written 14 pages of codes in C++.

1. System Design Question

He told me to design the database for GeeksforGeeks quizzes. It took me too much time, but I came up with the design with his help. 

Here's your problem of the day

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

Skill covered: Programming

Which SQL keyword removes duplicate records from a result set?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
2 rounds | 3 problems
Interviewed by GeeksforGeeks
1428 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 8 problems
Interviewed by GeeksforGeeks
15200 views
1 comments
0 upvotes
company logo
Intern
2 rounds | 3 problems
Interviewed by GeeksforGeeks
1200 views
0 comments
0 upvotes
company logo
SDE - Intern
3 rounds | 5 problems
Interviewed by GeeksforGeeks
787 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
Software Engineer
3 rounds | 5 problems
Interviewed by Mindtree
11082 views
7 comments
0 upvotes
company logo
Software Engineer
3 rounds | 7 problems
Interviewed by Optum
7002 views
1 comments
0 upvotes
company logo
Software Engineer
5 rounds | 5 problems
Interviewed by Microsoft
8503 views
1 comments
0 upvotes