intersection-Point

why this code is not passing all test cases?? I think this logic is correct.