Does anyone know how to solve this?
Anonymous User
136

Given an array and an integer n, find the minimum size of merged subarrays that we can make from the given array. (Merged subarrays has to be less than or equal to n)

public int question(int[] input, int n)

ex) int[] input = {3,2,3,3,1,8} , n=10 --> should return 2
possible subarrays --> {{3,2,3},{3,1},{8}} or {{8,1},{3,2,3},{3}} or etc
minimum number of subarrays --> {{2,8}, {1,3,3,3}}

Comments (0)