there onedimensional garden xaxis the garden start point 0 end point n ie the length garden nThere n 1 tap locate point 0 1 n gardengiven integer n integer array range length n 1 rangesi 0indexed mean ith tap water area rangesi rangesi openReturn minimum number tap open water garden if garden water return 1 Example 1input n 5 range 341100output 1explanation the tap point 0 cover interval 33the tap point 1 cover interval 35The tap point 2 cover interval 13the tap point 3 cover interval 24the tap point 4 cover interval 44the tap point 5 cover interval 55opene only second tap water garden 05Example 2input n 3 range 0000output 1explanation even activate tap water garden Constraints1 n 104rangeslength n 10 rangesi 100