Entering edit mode

Breakup (updated) -

- Base - 1,917,000
- Sign on 1 - 647,000
- Sign on 2 - 518,000
- RSU Value - 1,556,000 (vested over 4 years, 5% | 15% | 40% | 40%)

**Timeline**

- 05/ 08/ 2022: OA was conducted.
- 24/ 08/ 2022: Shortlists for interviews announced.
- 05/ 09/ 2022: Interviews.
- 08/ 09/ 2022: Results announced.

**44 were shortlisted for the interviews, among those 32 were eligible, and 11 were selected after the interviews.**

Amazon standard OA, consisted of 3 rounds (all compulsory and unproctured) and the result is given based on all the rounds combined.

**2 Coding Questions on Hackerrank Platform**

The time allotted is 2 hours, but try to complete both questions within 30 mins. Most of the shortlisted students completed both questions in around 15-20 minutes.

Easy to medium-level questions. One was a prefix sum based easy question, other was a variation of group merging.

This is a special round that assesses you based on decisions you make in the workstyle environment. There will be questions based on debugging, making decisions for you and your colleagues, and managerial decisions based on facts and reports. There is no time limit but try to complete it in 2-3 hours.

Large Questionnaire based on selecting from 2 given options. Most will be based on the leadership principles followed by Amazon. Go through them once before giving this round. No time limit for this round.

There were 3 technical+ leadership-based interview rounds (60 minutes or more based on your answers) and all were elimination rounds. Try to be vocal in each round and think out loud. The interviewer will always try to help you out if you're stuck somewhere.

Click here to Practice

Submit Problem to OJ

Q1: Find a single element in a sorted array of pairs of elements. LeetCode

Q2: Kth largest element in BST. GFG, GFG

Few questions regarding internships and projects.

I was stuck on the first question for a while and gave 2-3 approaches but the interviewer still asked me to think of a better approach, after 15-20 mins of discussion with the interviewer, I gave an approach in which the interviewer was satisfied and I quickly coded it up. I was able to Code the second question in time and the interviewer was satisfied with my approach and answers. I asked the interviewer about some of the areas that they work on at Amazon.

**Verdict: Qualified for the next round.**

Q1: Maximum area of an island. LeetCode

Click here to Practice

Submit Problem to OJ

Q2: Right-side view of a binary tree. LeetCode

Click here to Practice

Submit Problem to OJ

The interviewer was of a similar background as me so he chatted me up at the start of the interview and cross-questioned me regarding some of my projects. The interviewer was very friendly and helpful throughout. I was able to Code both questions in time and the interviewer was satisfied with my approach and answers.

**Verdict: Qualified for the next round.**

Q1: Minimum cost of joining ropes. LeetCode

Click here to Practice

Submit Problem to OJ

Q2: Next greatest element. LeetCode

Click here to Practice

Submit Problem to OJ

Few questions regarding my contribution to the company and my work during my internship, any hurdles faced during working with the team and how I dealt with them. A few questions regarding teamwork in my projects. This round went on for a little longer than the previous two.

I asked the interviewer about some major Departments that Amazon India works on and the current major research going on in the fields.

**Final Verdict: Selected**

Entering edit mode

We maintain a monotonic stack to solve this problem for all elements in the array. In order to find the next greater element, we should compare the current element with the elements in the stack.

- If current element > top element of the stack, current element is the next greater element of top element. We should also pop the top element because the current element could also be the next greater element of top element’s previous element.
- If current element <= top element of the stack, current element is not the next greater element. In this case, we push it into the stack and keep looking for the next greater elements.

```
nextGreaterElement(n, nums):
ans = [-1]*n
stack<int> st
for i from 0 to n:
while(!st.empty() and nums[i] > nums[st.top()]) ans[st.top()] = nums[i], st.pop()
st.push(i)
return ans
```

The time and space complexity are both `O(N)`

.

Entering edit mode

Given a grid of 0's and 1's, an island is a group of 1's (representing land) connected 4-directionally (horizontal or vertical.). Find the maximum area of an island.

For every un-visited 1, we can do bfs from that and maintain a count of ones encountered, which will tell the area of the island. Max of all such counts is the answer.

```
int solve(vector<vector<int>> grid) {
int n=grid.size(),m=grid[0].size();
vector<vector<int>> vis(n,vector<int>(m,0));
vector<int> dx={1,-1,0,0};
vector<int> dy={0,0,1,-1};
int ans=0;
for(int i = 0;i < n;i++)
{
for(int j = 0;j < m;j++)
{
if(vis[i][j]==1||grid[i][j]==0)
continue;
queue<pair<int,int>> q;
q.push({i,j});
vis[i][j]=1;
int cnt=0;
while(!q.empty())
{
auto x=q.front();
q.pop();
cnt++;
for(int l = 0;l < 4;l++)
{
int ni=x.first+dx[l],nj=x.second+dy[l];
if(ni<0||ni>=n||nj<0||nj>=m)
continue;
if(vis[ni][nj]==1||grid[ni][nj]==0)
continue;
vis[ni][nj]=1;
q.push({ni,nj});
}
}
ans=max(ans,cnt);
}
}
return ans;
}
```

Time Complexity: `O(N*M)`

Entering edit mode

- Find the minimum cost to merge all piles of ropes into one pile.

We know that we will be left with only one pile after all merge operations.

Now, let's begin thinking that in order to create one pile at the end, we, in the previous step, should be left with K piles so as to merge them into one pile. However, to obtain the minimum cost of creating one pile, we must create

`K`

piles in the previous step with minimum cost.We need to know the minimum cost of merging the left part to

`k - 1`

piles and the right part to`1`

piles.State: Minimum cost merging piles from

`i`

to`j`

to`k`

pile.

```
dp[i][j][1] = dp[i][j][K] + sum[i][j] (dp[i][j][K] != max)
dp[i][j][k] = min(dp[i][t][k - 1] + dp[t + 1][j][1]) (t ∈ [i, j) && dp[i][t][k - 1] != max && dp[t+1][j][1] != max && k ∈ [2, K])
Init: dp[i][i][1] = 0 (Already a pile) others = max
Answer: dp[1][len][1] (len is the ropes number)
```

Time Complexity: `O(N^3 * K), N`

is the size of the array.

Entering edit mode

Print the right side view of binary tree.

- Create an array whose length is equal to the height of the tree.
- apply any traversal and keep track of the level of every node in the tree of particular depth and keep updating in the array.
- while calling child just decrease and increase the levels of left and right nodes accordingly.

- always keep updating if at any depth you got a node whose level is higher then the previous.

> `O(n)`

where n is number of nodes in the binary tree.

```
void traverse(int node,vector<vector<int>>& level,int height,int cur_level){
if(cur_level>level[heigh][0]) {
level[height][0]= cur_level;
level[height][1]= tree[node];
}
traverse(2*node,level,height+1,cur_level-1);
traverse(2*node+1,level,height+1,cur_level+1);
}
```

Loading Similar Posts