Sponsored
Use these hints if you're stuck. Try solving on your own first.
Use divide and conquer technique.
Divide the query rectangle into 4 rectangles.
Use recursion to continue with the rectangles that has ships only.
Solve with full IDE support and test cases