Lab Goal : The lab was designed to teach you how to use arrays to simplify solving more complex problems. Lab Description : Given a provided array, determine how many groups of a specified size exist....


Lab Goal : The lab was designed to teach you how to use arrays to simplify solving more complex

problems.

Lab Description : Given a provided array, determine how many groups of a specified size exist.
For the array [1,1,1,2,2,2,3,3,3,4,5,6,7] , there are 7 groups with at least one, 3 groups with at

least 2, and 3 groups with at least 3. A group is a series of same values. 1 1 1 is a group of 3, but it also is

a group of 1 and 2. To count as a group, all values must be the same. 1 1 1 is a group of 3 because there

are 3 1s in a row.
Sample Data : 3 3 3 3 3 9 4 4 4 5 5 5 5 6 6 7 7 7 8 8 8 8 8 8 8 8




1 2 3 4 5 6 7 8 9


1 1 1 2 1 1 3 3 3 3 3 3 3 3 3 3 4 4 4 5 4 4 4 6


Sample Output : [3, 3, 3, 3, 3, 9, 4, 4, 4, 5, 5, 5, 5, 6, 6, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 8]
size 1 count == 7
size 2 count == 6
size 3 count == 5
size 4 count == 3
size 5 count == 2
size 6 count == 1


[1, 2, 3, 4, 5, 6, 7, 8, 9]
size 1 count == 9
size 2 count == 0
size 3 count == 0
size 4 count == 0


[1, 1, 1, 2, 1, 1, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 4, 4, 4, 5, 4, 4, 4, 6]
size 1 count == 8
size 2 count == 5
size 6 count == 1
size 8 count == 1



Jun 08, 2022
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here