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

SDE - 1

Razorpay
upvote
share-icon
3 rounds | 4 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 4 Months
Topics: Data structures, algorithms, oops, databases,Dynamic programming, recursion, backtracking, trees, graphs
Tip
Tip

Tip 1 : Prepare the basics firstly.
Tip 2 : No need to cover every topic in a fast pace. Take things slow and steady.
Tip 3 : Be disciplined . Dedicate a time slot to prepare for the topics.

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

Tip 1 : Resume should be well structured and must not contain irrelevant details like hobbies.
Tip 2 : Include atleast 2 projects and know about the in and out of those projects properly.

Interview rounds

01
Round
Medium
Online Coding Test
Duration90 Minutes
Interview date16 Aug 2019
Coding problem2

The online round was at 9 AM.
The coding env was very friendly. It didn't lag at all.
There was camera monitoring.

1. Right View

Moderate
35m average time
65% success
0/80
Asked in companies
AmazonAdobeUber

You have been given a Binary Tree of integers.

Your task is to print the Right view of it.

The right view of a Binary Tree is a set of nodes visible when the tree is viewed from the Right side and the nodes are printed from top to bottom order.

Problem approach

1. The problem can be solved using simple recursive traversal.
2. We can keep track of level of a node by passing a parameter to all recursive calls.
3. The idea is to keep track of maximum level also.
4. And traverse the tree in a manner that right subtree is visited before left subtree.
5. Whenever we see a node whose level is more than maximum level so far, we print the node because this is the last node in its level .

Try solving now

2. Maximum Subarray Sum

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

Given an array of numbers, find the maximum sum of any contiguous subarray of the array.


For example, given the array [34, -50, 42, 14, -5, 86], the maximum sum would be 137, since we would take elements 42, 14, -5, and 86.


Given the array [-5, -1, -8, -9], the maximum sum would be -1.


Follow up: Do this in O(N) time.

Problem approach

The simple idea is to look for all positive contiguous segments of the array (max_ending_here is used for this). And keep track of the maximum sum contiguous segment among all positive segments (max_so_far is used for this). Each time we get a positive sum compare it with max_so_far and update max_so_far if it is greater than max_so_far.

Initialize:
max_so_far = INT_MIN
max_ending_here = 0

Loop for each element of the array
(a) max_ending_here = max_ending_here + a[i]
(b) if(max_so_far < max_ending_here)
max_so_far = max_ending_here
(c) if(max_ending_here < 0)
max_ending_here = 0
return max_so_far

Try solving now
02
Round
Easy
Video Call
Duration45 Minutes
Interview date30 Aug 2019
Coding problem1

The round was at 12 PM .
The interviewer was very friendly.
We started with a brief introduction of ourselves and then he proceeded with the coding questions.

1. 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

started of with the bruteforce approach to calculate nearest left and nearest right larger height and thereby keep on adding the result.
I then gave a more optimised approach of keeping a left height and right height array and then calculating the result by adding the result for each iteration.

Algorithm:
Create two arrays left and right of size n. create a variable max_ = INT_MIN.
Run one loop from start to end. In each iteration update max_ as max_ = max(max_, arr[i]) and also assign left[i] = max_
Update max_ = INT_MIN.
Run another loop from end to start. In each iteration update max_ as max_ = max(max_, arr[i]) and also assign right[i] = max_
Traverse the array from start to end.
The amount of water that will be stored in this column is min(a,b) – array[i],(where a = left[i] and b = right[i]) add this value to total amount of water stored

Try solving now
03
Round
Easy
Video Call
Duration45 minutes
Interview date31 Aug 2019
Coding problem1

This round was final round.

1. Rod cutting problem

Moderate
40m average time
75% success
0/80
Asked in companies
Goldman SachsSamsungRazorpay

Given a rod of length ‘N’ units. The rod can be cut into different sizes and each size has a cost associated with it. Determine the maximum cost obtained by cutting the rod and selling its pieces.

Note:
1. The sizes will range from 1 to ‘N’ and will be integers.

2. The sum of the pieces cut should be equal to ‘N’.

3. Consider 1-based indexing.
Problem approach

1. A naive solution to this problem is to generate all configurations of different pieces and find the highest-priced configuration. This solution is exponential in terms of time complexity.
2. We can get the best price by making a cut at different positions and comparing the values obtained after a cut. We can recursively call the same function for a piece obtained after a cut.
Let cutRod(n) be the required (best possible price) value for a rod of length n. cutRod(n) can be written as follows.
cutRod(n) = max(price[i] + cutRod(n-i-1)) for all i in {0, 1 .. n-1}
Time Complexity: O(n2)

Space Complexity: O(n2)+O(n)
3. I then used an array to store maximum value.
static int cutRod(int price[],int n)
{
int val[] = new int[n+1];
val[0] = 0;

// Build the table val[] in bottom up manner and return
// the last entry from the table
for (int i = 1; i<=n; i++)
{
int max_val = Integer.MIN_VALUE;
for (int j = 0; j < i; j++)
max_val = Math.max(max_val,
price[j] + val[i-j-1]);
val[i] = max_val;
}

return val[n];
}

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
SDE - 1
3 rounds | 5 problems
Interviewed by Razorpay
3070 views
0 comments
0 upvotes
SDE - 1
2 rounds | 2 problems
Interviewed by Razorpay
1982 views
0 comments
0 upvotes
SDE - 1
3 rounds | 4 problems
Interviewed by Razorpay
1420 views
0 comments
0 upvotes
SDE - 1
4 rounds | 8 problems
Interviewed by Razorpay
1073 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