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

SDE - 2

Porter
upvote
share-icon
1 rounds | 2 Coding problems

Interview preparation journey

expand-icon
Preparation
Duration: 6 months
Topics: Data Structures, Algorithms, System Design, Aptitude, 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: Other
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
Video Call
Duration60 minutes
Interview date18 Oct 2021
Coding problem2

Technical Interview round where 2 DSA based questions were discussed.

1. Count number of occurrences (or frequency) in a sorted array

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

You are given a sorted array 'ARR' and a number 'X'. Your task is to count the number of occurrences of 'X' in 'ARR'.

Note :
1. If 'X' is not found in the array, return 0.
2. The given array is sorted in non-decreasing order.
Problem approach

Binary Search can be used in this problem.
Steps :
1) Use Binary search to get index of the first occurrence of x in the given array. Let the index of the first occurrence be i. 
2) Use Binary search to get index of the last occurrence of x in the given array. Let the index of the last occurrence be j. 
3) Return (j – i + 1);
Time Complexity: O(Logn)

Try solving now

2. Find the maximum path sum between two leaves of a binary tree

Hard
50m average time
35% success
0/120
Asked in companies
OYOAmazonMathworks

You are given a non-empty binary tree where each node has a non-negative integer value. Return the maximum possible sum of path between any two leaves of the given tree.

The path is also inclusive of the leaf nodes and the maximum path sum may or may not go through the root of the given tree.

If there is only one leaf node in the tree, then return -1.

Problem approach

One approach would be to traverse the tree and for every traversed node X :
1) Find maximum sum from leaf to root in left subtree of X 
2) Find maximum sum from leaf to root in right subtree of X. 
3) Add the above two calculated values and X->data and compare the sum with the maximum value obtained so far and update the maximum value. 
4) Return the maximum value.

The time complexity of above solution is O(n2)

This question can also be solved in a single traversal of binary tree. The idea is to maintain two values in recursive calls : 
1) Maximum root to leaf path sum for the subtree rooted under current node. 
2) The maximum path sum between leaves (desired output).

For every visited node X, we find the maximum root to leaf sum in left and right subtrees of X. We add the two values with X->data, and compare the sum with maximum path sum found so far.

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

What is recursion?

Choose another skill to practice
Similar interview experiences
company logo
SDE - 1
4 rounds | 8 problems
Interviewed by Amazon
8518 views
0 comments
0 upvotes
Analytics Consultant
3 rounds | 10 problems
Interviewed by ZS
907 views
0 comments
0 upvotes
company logo
SDE - Intern
1 rounds | 3 problems
Interviewed by Amazon
3319 views
0 comments
0 upvotes
company logo
SDE - 2
4 rounds | 6 problems
Interviewed by Expedia Group
2580 views
0 comments
0 upvotes
Companies with similar interview experiences
company logo
SDE - 2
5 rounds | 12 problems
Interviewed by Walmart
29570 views
8 comments
0 upvotes
company logo
SDE - 2
3 rounds | 4 problems
Interviewed by HashedIn
9584 views
0 comments
0 upvotes
company logo
SDE - 2
3 rounds | 5 problems
Interviewed by Amazon
6677 views
1 comments
0 upvotes