luoheng
9/7/2019 - 3:17 AM

MaxNonoverlappingSegments

# you can write to stdout for debugging purposes, e.g.
# print("this is a debug message")

def solution(A, B):
    # write your code in Python 3.6
    Sum, end = 0, -1
    for i in range(len(A)):
        if A[i] > end:
            Sum += 1
            end = B[i]
    return Sum