I was contacted by recruiter over linkedin for Senior Lead Software Engineer for Banglore location. I asked them for preparation time as I had holidays planned too. It took around 3-4 week. I went off for trekking and 2 days after I returned back home, i had first round ofinnterview schedule. I immediately got response after 3 hours from recruiter that I will be going for further rounds and all subsequent rounds were scheduled in next week. Out of 3 of us they had finalized after last round, I finally heard No from them saying they were quite impressed by my skills, accomplishments and achievements but due to tough competition, I won't be offered for the same role and at the same time, there is no similar position open so.
Below is my experience:
Round 1:
1) valid parentheses problem. Return number of braces required tio be inserted to complete valid parentheses in string
Note: () is valid but )( is invalid
Similar to : https://leetcode.com/problems/score-of-parentheses/
I/p 1: ()))((
O/p : 4 ---> because ()()()()()
I/p 2: ((()))
O/p : 0
2) subarray pair form given sum k.
Similar to : https://leetcode.com/problems/two-sum/
I/p : 1, 2,5, 4, 3 K=7
O/p : 2,5
I/p 2 : 3, 4, 1 k=6
Output : empty
I/p 3: 3, 2, 4, 3, 1, 3 k=6
O/p: 3,3
If using map approach, for duplicate element output condition would be:
if arr[I] == k-arr[I]
if m.get(arr[I]) > 1
then return arr[I]
Else
Return M.get(arr[I]) Round 2:
Q1)
Similar to: https://leetcode.com/problems/boundary-of-binary-tree/
4
/ \
6 9
/ \ \
3 1 0
/ \ \ / \
4 2 4 8 3
/ /
5 7
\
1
\
2
Print all peripheral nodes of the tree in clockwise order
4,3,6,4,9,0,3,7,8,4,5
Q2)
Given default index like 0,1,2,3,4,5,..... and array, find cycle and print node cound among cycle
0,1,2,3,4,5,6,7
int[]-> 2,4,4,5,0,8,9,6 -> 3
int[]-> 2,4,4,5,5,6,2,6 -> 4
Round 3: (Low level design(LLD) and project specific)
System Design For Vending Machine
User Base -
Operator - Refill Vending Machine , Take Money
Administrator - Control Vending Maching Administartive Tasks - Like Product Management , Machine Configuration (Products Suppiorted , Mon- ey ), User Roles/Password
End User (Customer)
products: food prod >> chocs/cadbury/milk/
machine connfig: add/delete/ update/ calculate
Requirements -
Primary
Should support RBAC Validation
Support
- Administartor Function like Product Management , Money Control, RBAC
- End user - Allow User to View Product , Select Product and Buy
- Method To Accept Money From EU , Perform Validation and Return Back Amount (if applicable)
Secondry
How to extend this to support Multiple User Role , Product and Currency
NFR like Scale
How To Manage Vending Machine Configuration from Central Location (Configurtion Like - Products Supported, Current Availability, State)
Usage Of SOLID Principles and Patterns Round 4: (Architect round)
JPA - how to write Many to many annotations.
If i want mutiple student to select multiple subject, write E2E code for JPA with Many to many relation. (Wrote Entity, repository and all) I kept it simple with relation table than many to many relation annotation usage.
authenticsation and authorization
- what do you pass to validate the request (Maybe username/password/token was not valid for him)
- How do you assure that incoming request is valid request
@Component
Interface I1
class A implements I1
Class B implements I2
main() {
@Autowired
I1 i;
//Will this compile, if not then what can make this work
//Requirement is to inject only class A
//:This can be achioeved through @Inject on class level
}Program :
a = 10, 11, 22
b = 6, 8, 12, 24
/*Note:
- Both arrays are sorted
- First element should be from A
- Last element should be from B
- Combination should be in ascending order
- Elements have to be subsequent from each array */
Output:
10, 12
10, 12, 22, 24
10, 24
11, 12
11, 12, 22, 24
11, 24
22, 24