/Infrrd-Private-Limited-assignment-Question

Write a program to combine elements into blocks with the given difference.

Primary LanguagePython

Infrrd-Private-Limited-assignment-Question

Write a program to combine elements into blocks with the given difference.

Eg: [13, 15, 25, 28, 38] -> [[13, 15], [25,28]] for a difference of 4.

Example 1: [17, 21, 80, 84, 86, 97, 120]

8

[[17, 21], [80, 84, 86]]

Example 2: [20, 23, 26, 28, 30, 37, 45, 47, 50, 60, 63, 65]

5

[[20, 23, 26, 28, 30], [45, 47, 50], [60, 63, 65]]