## Amazon Interview Question for Data Engineers

Country: United States
Interview Type: In-Person

Comment hidden because of low score. Click to expand.
0
of 0 vote

You can find the Answer from < geeksforgeeks > try Searching < Find the smallest positive number missing from an unsorted array >

Comment hidden because of low score. Click to expand.
0
of 0 vote

This is a typical dp problem very similar to edit distance etc. O(N) is the right complexity.

Comment hidden because of low score. Click to expand.
0
of 0 vote

``````def swap(A,B,i):
temp=A[i]
A[i]=B[i]
B[i]=temp

def minswaps(A,B):
n=len(A)
if n==0:
return Null
if n==1:
return 0
counter =0
for i in xrange(0,n-1):
if A[i+1]<=A[i]:
swap(A,B,i+1)
counter+=1
if B[i+1]<=B[i]:
return -1
return counter

A=[5,3,7,7,10]
B=[1,6,6,9,9]
print(minswaps(A,B))``````

Name:

Writing Code? Surround your code with {{{ and }}} to preserve whitespace.

### Books

is a comprehensive book on getting a job at a top tech company, while focuses on dev interviews and does this for PMs.

### Videos

CareerCup's interview videos give you a real-life look at technical interviews. In these unscripted videos, watch how other candidates handle tough questions and how the interviewer thinks about their performance.