Amazon OA | SDE-1 | Results Awaited
Anonymous User
1177

I applied to a lot of positions in Amazon. Not sure which one this test was about. No one called me or contacted me. The email stated, "Thank you for your interest in Amazon's Software Development Engineer (SDE) opportunities! We would like to invite you to complete our online assessment, the first step of our recruitment process...."

I was redirected to Hackerrank with 2 questions.

Question 1
Find the password strength.
For each substring of the password which contains at least one vowel and one consonant, its strength goes up by 1.
vowels={'a', 'e', 'i', 'o', 'u'}, and rest of letters are all consonant.
(Only lower alphabet letters)

Input String: hackerrank
Expected output: 3

Explaination: hack er rank

Solution:
Simply iterated and calculated vowels and consonants in variables. In case both variables were greater than 1, inreased cnt by 1 and reset the vowel and consonant count to 0.
This was a simple O(n) solution with all test cases passed.

Question 2
Find the shortest number of steps taken by a robot which stands at top left corner to reach its destination. '0' represents path, '1' represents obstacle, and '9' represents destination

arr = 0 1 0
0 0 0
1 9 1

ans = 2
step 1: from (0,0) we can go to (1,0) and (1,1)
step 2: from (1,1) we can go to (2,1) which has destination 9, returning 2 and (1,2)

Solution
Applied BFS from given start (top-left) and tried moving in all 4 directions. Just had following check

di=[-1,0,1,0]
dj = [0,-1,0,1]
if(nrow>=0 && nrow<n && ncol>=0 && ncol<n && arr[nrow][ncol] != 1 && !vis[nrow][ncol])
	queue.push(row: nrow, col: ncol)
	vis[nrow][ncol]=1

This was a simple O(n*m) solution which passed all test cases.

It's been more than 7 days I've given OA, there is no reply on email and not any call received as well.
Instead I've been receiving some rejections on different SDE positions I applied earlier.

Not sure what amazon wants, despite solving both questions with flying colors, there is not update.

Comments (7)