Relative Content

Tag Archive for javaintervalsdsa

Leetcode 452 – Minimum number of arrows to burst balloons | Why does my code not work for certain testcases?

class Solution { public int findMinArrowShots(int[][] points) { Arrays.sort(points, Comparator.comparingInt(point -> point[0])); int min = 1; int left = points[0][0]; int right = points[0][1]; for(int i=1; i<points.length; i++) { if((left <= points[i][0] && right >= points[i][0]) || (left <= points[i][1] && right >= points[i][1])) { continue; } else { left = points[i][0]; right = points[i][1]; […]