3394. Check if Grid can be Cut into Sections #63
-
🟩 3394. Check if Grid can be Cut into SectionsMedium | Grid | Geometry | Sorting 📝 Problem StatementYou are given an integer You are also given a 2D array of coordinates Each rectangle is defined as follows:
Your task is to determine if it is possible to make either two horizontal or two vertical cuts on the grid such that:
Return 🔹 Example 1Input:n = 5
rectangles = [[1,0,5,2],[0,2,2,4],[3,2,5,3],[0,4,4,5]] Output:true Explanation:We can make horizontal cuts at
Hence, output is 🔹 Example 2Input:n = 4
rectangles = [[0,0,1,1],[2,0,3,4],[0,2,2,3],[3,0,4,3]] Output:true Explanation:We can make vertical cuts at 🔹 Example 3Input:n = 4
rectangles = [[0,2,2,4],[1,0,3,2],[2,2,3,4],[3,0,4,2],[3,2,4,4]] Output:false Explanation:We cannot make two horizontal or two vertical cuts that satisfy the conditions. Hence, output is 🛠 Constraints✅ 💡 Approach & Hints
🔹 If a valid set of two horizontal or two vertical cuts exists, return ⏳ Time Complexity Analysis
✍ Author👤 Your Name 📢 Feel free to contribute by improving the solution or adding more test cases! 🚀
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
solve that to contribute [organization] |
Beta Was this translation helpful? Give feedback.
solve that to contribute [organization]