## Anagram Checks - Amazon Top Interview Questions

Given two strings s0 and s1, return whether they are anagrams of each other. Constraints n ≤ 100,000 where n is the length of s0 m ≤ 100,000 where m is the length of s1 Example 1 Input s0 = "listen" s1 = "silent" Output True Example 2 Input s0 = "bedroom" s1 = "bathroom" Output False

## Hash Table - Amazon Top Interview Questions

Implement a hash table with the following methods: HashTable() constructs a new instance of a hash table put(int key, int val) updates the hash table such that key maps to val get(int key) returns the value associated with key. If there is no such key, then return -1. remove(int key) removes both the key and the value associated with it in the hash table. This should be implemented without using built-in hash table. Constraints n ≤ 100,000 where n is the number of calls to put, get

## Matrix Search - Amazon Top Interview Questions

Given a two-dimensional integer matrix, where every row and column is sorted in ascending order, find the kth (0-indexed) smallest number. Constraints n, m ≤ 250 where n and m are the number of rows and columns in matrix Example 1 Input matrix = [ [1, 3, 30], [2, 3, 31], [5, 5, 32] ] k = 4 Output 5 Example 2 Input matrix = [ [1, 2, 3] ] k = 0 Output 1 Example 3 Input matrix = [ [1], [2], [3] ] k =

## Light Bulb Toggling - Amazon Top Interview Questions

You are given an integer n, and there's n switches in a room all in off position and n people who flip switches as follows: Person 1 comes and flips all switches that are multiples of 1, so all of them. Person 2 flips switches that are multiples of 2: 2, 4, 6, ... Person i flips switches that are multiples of i. Return number of switches that will be in on position at the end. Constraints 0 ≤ n < 2 ** 31 Example 1 Input n = 4 Output 2 Explanation Initially the bulbs

## Spiral Matrix - Amazon Top Interview Questions

Given a 2-d array matrix, return elements in spiral order starting from matrix[0][0]. Constraints n, m ≤ 250 where n and m are the number of rows and columns in matrix Example 1 Input matrix = [ [6, 9, 8], [1, 8, 0], [5, 1, 2], [8, 0, 3], [1, 6, 4], [8, 8, 10] ] Output [6, 9, 8, 0, 2, 3, 4, 10, 8, 8, 1, 8, 5, 1, 8, 1, 0, 6]