## The product mystery - Codechef

Given two positive numbers B and C, what is the minimum positive value of A, such that A⋅B is divisible by C. Here, A⋅B denotes the value obtained when A is multiplied by B. Input Format The first line will contain an integer T - number of test cases. Then the test cases follow. The first and only line of each test case contains two integers B and C. Output Format For each test case, output the minimum value of A such that A⋅B is divisible by C. Constraints 1≤T≤105 1≤B,C≤1

## Rotation Groups - Amazon Top Interview Questions

A rotation group for a string contains all of its unique rotations. For example, "123" can be rotated to "231" and "312" and they are all in the same rotation group. Given a list of strings words, group each word by their rotation group, and return the total number of groups. Constraints n ≤ 200 where n is the length of words. Example 1 Input words = ["abc", "xy", "yx", "z", "bca"] Output 3 Explanation There are three rotation groups: ["abc", "bca"] ["xy

## Pascal's Triangle - Amazon Top Interview Questions

Given an integer n, return the nth (0-indexed) row of Pascal's triangle. Pascal's triangle can be created as follows: In the top row, there is an array of 1. Each subsequent row is created by adding the number above and to the left with the number above and to the right, treating empty elements as 0. Example 1 Input n = 3 Output [1, 3, 3, 1] Explanation This is row 3 in  [1, 1] [1, 2, 1] [1, 3, 3, 1]

## Unidirectional Word Search - Amazon Top Interview Questions

Given a two-dimensional matrix of characters board and a string target, return whether the target can be found in the matrix by going left-to-right, or up-to-down unidirectionally. Constraints n, m ≤ 250 where n is the number of rows and columns in board k ≤ 250 where k is the length of word Example 1 Input board = [ ["H", "E", "L", "L", "O"], ["A", "B", "C", "D", "E"] ] word = "HELLO" Output True Example 2 Input board = [ ["x", "z", "d", "x"],

## In-Place Move Zeros to End of List - Amazon Top Interview Questions

Given a list of integers nums, put all the zeros to the back of the list by modifying the list in-place. The relative ordering of other elements should stay the same. Can you do it in \mathcal{O}(1)O(1) additional space? Constraints 0 ≤ n ≤ 100,000 where n is the length of nums Example 1 Input nums = [0, 1, 0, 2, 3] Output [1, 2, 3, 0, 0] Explanation Note that [1, 2, 3] appear in the same order as in the input.