Flipkart SDE - 1

flipkart logo
flipkart
SDE - 1
October 3, 20256 reads

Summary

I recently interviewed at Flipkart for an SDE-1 position and was presented with a Data Structures & Algorithms problem involving detecting duplicate parentheses in a balanced expression. I successfully explained my stack-based approach and provided a C++ solution.

Full Experience

I had a technical interview at Flipkart for the SDE-1 role. The interviewer presented me with a problem to determine if a given balanced expression contains duplicate parentheses. I clarified the problem statement using the provided examples, noting that duplicate parentheses mean a subexpression is enclosed by more than one pair of brackets. I then walked through my thought process, explaining how a stack could be used to efficiently solve this problem by tracking characters and checking for the count of non-'(' characters between matching parentheses. After detailing my approach, I proceeded to implement the solution in C++.

Interview Questions (1)

Q1
Detect Duplicate Parentheses in Balanced Expression
Data Structures & AlgorithmsMedium

Given a balanced expression, find if it contains duplicate parenthesis or not. A set of parenthesis are duplicate if the same subexpression is surrounded by multiple parenthesis

Below expressions have duplicate parenthesis -
((a+b)+((c+d)))
The subexpression "c+d" is surrounded by two
pairs of brackets.


Below expressions don't have any duplicate parenthesis -
((a+b)+(c+d))
No subexpression is surrounded by duplicate
brackets.

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

Be the first to share your thoughts and start the discussion!