3 ms·
Without any conditions on the input, you cannot stop early and must visit each element at least once. The candidate selection I mentioned is for picking which e
by trinovantes 5y ago
Without any conditions on the input, you cannot stop early and must visit each element at least once. The candidate selection I mentioned is for picking which edge to keep as you reduce the search space for a potentially bigger area (sorry if I didn't explain it clearly).
[3,2,100,100,2,3]
[2,100,100,2,3] (keep right 3, check if 2-3 has a larger area)
[100,100,2,3] (keep right 3, check if 100-3 has a larger area)
[100,100,2] (keep left 100, check if 100-2 has a larger area)
[100,100] (keep left 100, check if 100-100 has a larger area)