Amazon Machine Learning Engineer Coding & Algorithms Interview Questions
Master your tech interview with our curated database of real questions from top companies.
Implement PyTorch training loop
Implement a basic PyTorch training loop You are given a PyTorch neural network model, a DataLoader that yields (inputs, targets) batches, an optimizer...
Find shortest path in a grid with obstacles
You are given a 2D grid of size m x n representing a maze. Each cell in the grid is either empty (0) or blocked (1). You are also given two coordinate...
Implement integer division without using division
You are given two 32-bit signed integers dividend and divisor. Implement a function that divides dividend by divisor and returns the integer quotient,...
Implement lower_bound and upper_bound binary search
Implement two functions for a nondecreasing sorted integer array nums of length n: lower_bound(target) returns the smallest index i such that nums[i] ...
Implement binary search lower/upper bounds
Given a non-decreasing sorted array nums and a target value, implement two functions using binary search: ( 1) lower_bound(nums, target) that returns ...
Implement inventory allocation with backorders
Design and implement a function to process an event stream for an e-commerce marketplace. Input: ( 1) initial inventory as a list of (sku: string, qty...