You are installing water pipes made by a company with poor quality control.
In a single piece of pipe, you have found several leaks that should be fixed.
The leaks are all aligned on top of the pipe, and each leak is an integer number of inches from the left end of the pipe.
You have an infinite supply of L-inch long pieces of adhesive tape.
Each leak must be covered by at least one layer of tape.
To prevent the leaks from growing, you must always leave at least 0.5 inches of tape on each side of a leak.
The leaks have negligible length, so a single leak can be covered by a 1-inch piece of tape.
You are given the positions of all the leaks in the int[] leaks.
The i-th element is the distance of the i-th leak from the left end of the pipe.
Return the minimum number of pieces of adhesive tape needed to fix them all.
|