Category: Amazon Interview

Join me to stay up-to-date and get my new articles delivered to your inbox by subscribing here.

Coding Interview Question: Find the greatest integer smaller than N with the same set of digits as N - October 20, 2022

Question Given an integer N, find the greatest integer less than N and has the same digits. If there is no such integer, return -1. For example: Input = 630 Output = 603 Input = 603 Output = 360 Input = 360 Output = 306 Input = 306 Output = -1 (Be careful, 063 could […]

Read more

Coding Interview Question: Nested List Weight Sum - October 15, 2022

Question Imagine an array that contains both integers and nested arrays, such as the following: [[2, [9, 1, 3], 8], 1, 4]. The depth sum is described as the weighted sum of each integer, weighted by their respective depths. In the example, 9’s depth is 3, while 8’s depth is 2, and 4’s depth is […]

Read more

Google Meta Amazon Coding Interview Question – Toeplitz Matrix - March 22, 2022

Given a matrix in the form (int height, int weight, vector < vector < int > > matrix), determine if the matrix is in the form of Toeplitz. In linear algebra, a Toeplitz matrix or diagonal-constant matrix, named after Otto Toeplitz, is a matrix in which each descending diagonal from left to right is constant. […]

Read more