from bisect import bisect_left

def solution(sensor_data):
    lis = []

    for num in sensor_data:
        idx = bisect_left(lis, num)

        if idx == len(lis):
            lis.append(num)
        else:
            lis[idx] = num

    return len(lis)


sensor_data = [10, 20, 10, 30, 20, 50]
print(solution(sensor_data))

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: