Hi, I noticed that if we use Arrays.sort() in java 8 format, then the code will much slower than the old format. I run each format twice, the time of java 8 format is 113ms, 126m, however, another one is 45 ms, 45ms. Can anyone explain why? Thanks!
@westwatermelon indeed,sort by start-point works as well, for your example [1,10],[2,3] ,we just need shoot 3 instead of 10. So when we update the end-point when current point's end is smaller than the previous farthest possible end.
@wangxinbo Geat solution and clear explanation! Only one small suggestion: in your solution for findMinArrowShots, you don't need minEnd = INTMAX, because on the first element, you're setting minEnd to the minimum of minEnd and p.second anyways, so you can just do minEnd = p.second in the first row.