## GUPTA MECHANICAL

IN THIS WEBSITE I CAN TELL ALL ABOUT TECH. TIPS AND TRICKS APP REVIEWS AND UNBOXINGS ALSO TECH. NEWS .............

## [Solution] AP Grid CodeChef Solution

Construct an $N×M$ matrix with entries having positive integers such that:

• If $M>1$${i}^{th}$ row is strictly increasing from left to right with a fixed common difference ${d}_{i}$ for all $1\le i\le N$.
• If $N>1$${j}^{th}$ column is strictly increasing from top to bottom with a fixed common difference ${c}_{j}$ for all $1\le j\le M$.
• All the common differences should be distinct.
• In the case of multiple answers, find an arrangement that minimizes the maximum element of the matrix.

### Input Format

• First line will contain $T$, number of test cases. Then the test cases follow.
Solution Click Below:-  👉
👇👇👇👇👇

• Each test case contains a single line of input, two space-separated integers $N$ and $M$ - the dimensions of the matrix.

### Output Format

For each test case, output $N$ lines with each line having $M$ space-separated integers representing

Fitness CodeChef Solution

Complementary Strand in a DNA CodeChef Solution

Make all equal using Pairs Codechef Solution

Count the ACs CodeChef Solution

Strong Elements CodeChef Solution

Reversal Sorting CodeChef Solution

AP Grid CodeChef Solution

Gcd and Lcm CodeChef Solution

The Subarray XOR CodeChef Solution

• $1\le T\le 10$