Skip to content
Katabench
Try free

Longest Rising Streak

Easy About 10 min Free, no account needed

Measure a consecutive telemetry climb without rescanning every possible starting point.

The brief

A sensor records readings in order. Return the length of its longest contiguous, strictly increasing run. Equal neighbors break a run. You cannot skip a reading.

Solve([1, 3, 2, 4, 5]) returns 3, for [2, 4, 5]. This is a consecutive streak, not an increasing subsequence.

An empty input returns 0. There are at most 200,000 readings, each a signed 32-bit integer. Do not modify the input. The large test rejects rescanning forward from every start.

Starter code

C#
using System;

public class Solution
{
    public int Solve(int[] readings)
    {
        // TODO: implement the contract without changing the input.
        throw new NotImplementedException();
    }
}

How it is graded

Visible examples help you iterate. Hidden tests then cover edge cases and larger inputs, and every test reports server-measured time and allocated bytes.

C# coding challenges →

What it practices

Sliding window
Grow and shrink a contiguous range while maintaining its state incrementally.

Related katas