From 99dee88b14caf017af666cf852b9d5d902ff721f Mon Sep 17 00:00:00 2001 From: Xtha-Sunil Date: Wed, 30 Oct 2024 23:32:24 +0545 Subject: [PATCH] Added solution for maximize area of square hole in grid. --- C++/maximize-area-of-square-hole-in-grid.cpp | 32 ++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 C++/maximize-area-of-square-hole-in-grid.cpp diff --git a/C++/maximize-area-of-square-hole-in-grid.cpp b/C++/maximize-area-of-square-hole-in-grid.cpp new file mode 100644 index 0000000..fccbfb1 --- /dev/null +++ b/C++/maximize-area-of-square-hole-in-grid.cpp @@ -0,0 +1,32 @@ +class Solution { +public: + int maximizeSquareHoleArea(int n, int m, vector& hBars, vector& vBars) { + int h = hBars.size(); + int v = vBars.size(); + + sort(hBars.begin(),hBars.end()); + sort(vBars.begin(),vBars.end()); + + int mxh = 1, mxv = 1,curr = 1; + + for(int i=1; i