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

SDE - 1

Grab
upvote
share-icon
3 rounds | 6 Coding problems

Interview preparation journey

expand-icon
Journey
When I joined college, I was unaware of Data Structures and Algorithms, which made my journey to securing an internship much more challenging. From that point on, I started solving problems on various coding platforms.
Application story
This company visited my campus for recruitment. They first conducted a test and then allowed us to proceed to the interview.
Why selected/rejected for the role?
I was rejected because I have a strong background in content preparation but do not have a decent ranking on competitive coding platforms.
Preparation
Duration: 4 months
Topics: Data Structures, Pointers, OOPS, System Design, Algorithms, Dynamic Programming
Tip
Tip

Tip 1: Practice coding problems from online platforms, focusing on medium-level challenges.
Tip 2: Refresh your computer science fundamentals, including Operating Systems, Databases, and Computer Networks.
Tip 3: Gain hands-on experience through a strong project or a meaningful internship and have an in-depth understanding of your work.

Application process
Where: Campus
Eligibility: No criteria
Resume Tip
Resume tip

Tip 1: Include some projects on your resume.
Tip 2: Do not include false information on your resume.

Interview rounds

01
Round
Medium
Video Call
Duration60 minutes
Interview date28 Jan 2023
Coding problem2

1. All Possible Balanced Parentheses

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

You are given a positive integer 'N'. You have to generate all possible sequences of balanced parentheses using 'N' pairs of parentheses.

A sequence of brackets is called balanced if one can turn it into a valid math expression by adding characters ‘+’ and ‘1’. For example, sequences ‘(())()’, ‘()’ and ‘(()(()))’ are balanced, while ‘)(‘, ‘(()’ and ‘(()))(‘ are not.

For example :
For N = 1, there is only one sequence of balanced parentheses,  ‘()’.

For N = 2, all sequences of balanced parentheses are ‘()()’, ‘(())’.
Problem approach

The idea is to push all opening brackets onto a stack. Whenever a closing bracket is encountered, check if the top of the stack contains the corresponding opening bracket. If it does, pop the stack and continue the iteration. In the end, if the stack is empty, it means all brackets are properly matched. Otherwise, they are unbalanced.

Try solving now

2. Ninja's Encryption

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

Ninja has created his own encryption technique to encrypt a number. He makes use of the logic behind factorial. In a factorial, we multiply the number by its previous number and so on but if we want to encrypt a number we don’t multiply in every step like in the case of factorial but multiply, divide, add and subtract and repeat in the same order.

So your task is to find the encrypted form of a number using the ninja encryption technique and you were being provided with the number.

Problem approach

Given a numeric string 'STR' that consists of digits from '0' to '9', you need to encrypt the string by replacing each digit as described below:
‘0’ -> ‘9’
‘1’ -> ‘8’
‘2’ -> ‘7’ and so on till ‘9’ -> ‘0’

Try solving now
02
Round
Easy
Video Call
Duration60 minutes
Interview date28 Jan 2023
Coding problem2

1. Restore IP Addresses

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

You are given a string 'S' containing only digits. Your task is to find all possible IP addresses that can be obtained from string 'S' in lexicographical order.

Note:
A valid IP address consists of exactly four integers, each integer is between 0 and 255 separated by single dots, and cannot have leading zeros except in the case of zero itself.
For example:
The following are valid IP addresses:
0.1.24.255
18.5.244.1

Following are invalid IP addresses:
0.01.24.255  (as  01  contains one leading zero).
18.312.244.1 (as 312 not lies between 0 and 255).
Problem approach

You are given a string "S" containing only digits from 0 to 9. Your task is to find all possible IP addresses that can be formed from S in lexicographical order. If no valid IP address can be generated, return an empty string.

Try solving now

2. Search in Rotated Sorted Array

Moderate
30m average time
65% success
0/80
Asked in companies
InformaticaDelhiveryGoldman Sachs

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

The idea is to create a recursive function to implement binary search within the search region [l,r]. In each recursive call:

  • We calculate the middle value as mid = (l + h) / 2.
  • Then, we determine whether the segment from l to mid is sorted or if the segment from mid + 1 to h is sorted.
  • Based on this, we decide the next search region and continue this process until the element is found or l exceeds h.
Try solving now
03
Round
Medium
Video Call
Duration60 minutes
Interview date28 Jan 2023
Coding problem2

1. Find Palindromes

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

You are given an integer ‘N’. Your task is to find all palindromic numbers from 1 to ‘N’.

Palindromic integers are those integers that read the same backward or forwards.

Note:
Order of numbers should be in the non-decreasing matter.
For example:
You are given ‘N’ as 12, so the output should be [1, 2, 3, 4, 5, 6, 7, 8, 9, 11], as all single-digit numbers are palindromic, and 11 is also a palindromic number.
Problem approach

You are given a string STR of length N, consisting of lowercase English alphabet letters. Your task is to return the minimum number of characters that need to be added at the front to make the string a palindrome.

Try solving now

2. Trapping Rain Water

Moderate
15m average time
80% success
0/80
Asked in companies
HCL TechnologiesCiti BankAtlassian

You have been given a long type array/list 'arr’ of size 'n’.


It represents an elevation map wherein 'arr[i]’ denotes the elevation of the 'ith' bar.



Note :
The width of each bar is the same and is equal to 1.
Example:
Input: ‘n’ = 6, ‘arr’ = [3, 0, 0, 2, 0, 4].

Output: 10

Explanation: Refer to the image for better comprehension:

Alt Text

Note :
You don't need to print anything. It has already been taken care of. Just implement the given function.
Problem approach

You are given a long-type array or list 'ARR' of size 'N', representing an elevation map where ARR[i] denotes the elevation of the i-th bar. Print the total amount of rainwater that can be trapped between these elevations.

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
SDE - 1
2 rounds | 4 problems
Interviewed by Grab
873 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Grab
1090 views
0 comments
0 upvotes
company logo
SDE - 1
3 rounds | 5 problems
Interviewed by Grab
626 views
0 comments
0 upvotes
company logo
SDE - 1
2 rounds | 4 problems
Interviewed by Grab
592 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 1
5 rounds | 12 problems
Interviewed by Amazon
115097 views
24 comments
0 upvotes
company logo
SDE - 1
4 rounds | 5 problems
Interviewed by Microsoft
58238 views
5 comments
0 upvotes
company logo
SDE - 1
3 rounds | 7 problems
Interviewed by Amazon
35147 views
7 comments
0 upvotes