Sobes.tech
Junior — Senior

Finding the maximum length of consecutive elements of a given number in an array

livecode

Task condition

It is necessary to implement a function that calculates the length of the longest continuous subsequence consisting of a given number in a vector of integers.

Example: array = [1, 2, 3, 3, 3, 1, 3, 3, 3, 3], target number = 3 → result = 4

int find_max_streak(const std::vector<int>& arr, int target)
{
    return 0;
}