Problem 42273. Form Blocks in a 1D array

Created by Rushikesh Tade in Community

Lets say I have an array of size (10,1);

I want to divide it into the num number of blocks which are given by user


output should be lower and upper limits of blocks

output_blocks=[1 5;6 10]

another example

array of size (1,36) divide into 7 blocks

output should be [1 7; 8 14; 15 21; 22 28; 29 35]

that is reject the remaining indices if it is not in the last block;

input arguments for the function are length of an array and no of blocks required.

Solution Stats

77.78% Correct | 22.22% Incorrect
Last solution submitted on Nov 21, 2018