3
bool isSelfCrossing(vector<int> &distance) {4
if (distance.size() <= 3) return false; // only can have intersection with more than 4 lines6
distance.insert(distance.begin(),7
0); // for the edge case: line i intersect with line i-4 at (0, 0)8
for (int i = 3; i < distance.size(); i++) {10
if (distance[i - 2] <= distance[i] && distance[i - 1] <= distance[i - 3]) return true;14
if (distance[i - 1] <= distance[i - 3] &&15
distance[i - 1] >= distance[i - 3] - distance[i - 5] &&16
distance[i - 2] >= distance[i - 4] && distance[i - 2] <= distance[i - 4] + distance[i])