I solved my problem by using simple nested loops and comparisons but I'm wondering if there is a well known Selection Algorithm to solve my problem.
Let's say I have an array such as
[1, 10, 250, 9, 8,8, 249, 249, 248, 247, 2, 4, 9, 10, 9, 7, 6]
I need to find subarrays
[6,7,8,9,10] [8,9,10] [247, 248, 249, 250]
Subarrays should be min. 3 length size.
I dont want a solution but a similar algorithm would help me refactor my code.
I'm currently doing this with nested loops and using buffer collections.
[6,7,8,9,10,11] [8,9,10]
was the only answer or if[6,7,8,9,10] [8,9,10,11]
is a valid answer. – MichaelT Apr 2 at 19:46