## Contiguously Increasing Numbers - Amazon Top Interview Questions

Given two integers start and end, return a sorted list of integers such that every number e is between start ≤ e ≤ end and the digits of e are contiguously increasing. For example, 2345 is contiguously increasing while 135 and 321 are not. Constraints 0 ≤ start ≤ end < 2 ** 31 Example 1 Input start = 0 end = 100 Output [1, 2, 3, 4, 5, 6, 7, 8, 9, 12, 23, 34, 45, 56, 67, 78, 89]

View Solution →## Subsequence Strings - Amazon Top Interview Questions

Given two lowercase alphabet strings s1 and s2, determine if s1 is a subsequence of s2. Constraints n ≤ 100,000 where n is the length of s1 m ≤ 100,000 where m is the length of s2 Example 1 Input s1 = "ppl" s2 = "apple" Output True Example 2 Input s1 = "ale" s2 = "apple" Output True Example 3 Input s1 = "elppa" s2 = "apple" Output False

View Solution →## Knight Remains - Amazon Top Interview Questions

You are given four integers n, x, y, and k. n represents an n by n chessboard and x, y represents a knight positioned at (x, y). The knight has to take exactly k steps, where at each step it chooses any of the 8 directions uniformly at random. Return the percentage chance rounded down to the nearest integer that the knight remains in the chessboard after taking k steps, with the condition that it can’t enter the board again once it leaves it. Constraints 1 ≤ n ≤ 25 0 ≤ k ≤ 100 Examp

View Solution →## Count Contained Intervals - Amazon Top Interview Questions

You are given a two-dimensional list of integers intervals. Each value is unique and contains an inclusive interval [start, end]. Return the number of intervals are contained by another interval. An interval that's contained by multiple other intervals should only be counted once. An interval [s0, e0] contains another interval [s1, e1] if s0 ≤ s1 and e0 ≥ e1. Constraints 0 ≤ n ≤ 100,000 where n is the length of intervals Example 1 Input intervals = [ [1, 5], [2, 3],

View Solution →## Reflected Binary Code - Amazon Top Interview Questions

Given an integer n, return the nth (0-indexed) gray code number. Gray code is a way of ordering binary numbers such that each consecutive number's values differ by exactly one bit. The first few gray codes are: [0, 1, 11, 10, 110, 111, ...] Constraints 0 ≤ n ≤ 1,000,000 Example 1 Input n = 3 Output 2

View Solution →