• + 0 comments

    My humble python solution:

    # Write your code here
    
    #left to right
    min_left = p // 2
    
    #right to left
    n = n + 1 if n % 2 == 0 else n
    min_right = (n - p) // 2
    
    return min_left if min_left <= min_right else min_right