⏱️ Time & Space Complexity
⏱️ T.C : O(n log n)
→ Sliding window + TreeSet insert/remove & rebalancing
🫙 S.C : O(n)
→ Two TreeSets to manage window elements
⏱️ Time & Space Complexity
✅ T.C : O(n) Each number is processed in constant time (bit shifts are bounded by 32 bits).
✅ S.C : O(1) (excluding output array)
⏱️Time & Space Complexity
⌚T.C : O(H² + V²)
H = number of horizontal fences
V = number of vertical fences
We check all pairwise distances
🫙S.C : O(H²)
For storing all horizontal distances in a HashSet
🇮🇳🔹 LeetCode Daily Challenge
📘 LC.: 2975 – Maximum Square Area by Removing Fences
💡 Approach: Common Distance Matching
🔥 Day 767 Streak 💪
❤️ Like | 🔍 Follow @Kartscode#LeetCode#ProblemSolving#BuildInPublic#DSA