Question d’entretien chez HARMAN

In an integer array, group them in a sequence and print the sum of largest sequence. For example, if an array has elements {10, 1000, 20, 5, 30, 2000, 6, 3000, 7}, you will have to find out the possible sequences (here they are {5, 6, 7} {10, 20, 30} and {1000, 2000, 3000}) and print the sum of largest sequence. Here it is 6000.