two pointer, one loop, refer other's elegant code, bound station need to consider