From d0f2ce764fc1157118329a4d823596fe5388b5af Mon Sep 17 00:00:00 2001 From: Rishabh Singh <106950554+rishabh-xyd@users.noreply.github.com> Date: Tue, 25 Mar 2025 12:33:35 +0530 Subject: [PATCH 1/2] leetcode 3394 solution Updated this repo with leetcode problem 3394 with cpp code --- .../README.md | 33 ++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/solution/3300-3399/3394.Check if Grid can be Cut into Sections/README.md b/solution/3300-3399/3394.Check if Grid can be Cut into Sections/README.md index b7dbdc3ca45bc..231f84cb69dc0 100644 --- a/solution/3300-3399/3394.Check if Grid can be Cut into Sections/README.md +++ b/solution/3300-3399/3394.Check if Grid can be Cut into Sections/README.md @@ -115,7 +115,38 @@ tags: #### C++ ```cpp - +class Solution { +public: +vector> merge(vector>& intervals){ + int n=intervals.size(); + sort(begin(intervals),end(intervals)); + vector>result; + result.push_back(intervals[0]); + for(int i=0;i>& rectangles) { + vector>hor; + vector>vert; + for(auto &cord:rectangles){ + int x1=cord[0]; + int y1=cord[1]; + int x2=cord[2]; + int y2=cord[3]; + hor.push_back({x1,x2}); + vert.push_back({y1,y2}); + } + vector> result1= merge(hor); + if(result1.size()>=3) + return true; + vector> result2=merge(vert); + return result2.size()>=3; + } +}; ``` #### Go From 7a687f60624c8d74b325a605808c179cbe2e17d5 Mon Sep 17 00:00:00 2001 From: rishabh-xyd <106950554+rishabh-xyd@users.noreply.github.com> Date: Tue, 25 Mar 2025 07:53:07 +0000 Subject: [PATCH 2/2] style: format code and docs with prettier --- .../3394.Check if Grid can be Cut into Sections/README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/solution/3300-3399/3394.Check if Grid can be Cut into Sections/README.md b/solution/3300-3399/3394.Check if Grid can be Cut into Sections/README.md index 231f84cb69dc0..ac407b5164a0e 100644 --- a/solution/3300-3399/3394.Check if Grid can be Cut into Sections/README.md +++ b/solution/3300-3399/3394.Check if Grid can be Cut into Sections/README.md @@ -144,7 +144,7 @@ vector> merge(vector>& intervals){ if(result1.size()>=3) return true; vector> result2=merge(vert); - return result2.size()>=3; + return result2.size()>=3; } }; ```