Перейти к содержимому

Daily LeetCode Problem 836 | Rectangle Overlap in O(1) | The 4 Non-Overlap Cases | 14/09/26

EdgeCaseOffByOne

0:00 / 0:00

Daily LeetCode Problem 836 | Rectangle Overlap in O(1) | The 4 Non-Overlap Cases | 14/09/26

80 просмотров · 3 нед. назад
EdgeCaseOffByOne
116 подписчиков
80 просмотров · 3 нед. назад
Can you tell if two rectangles actually overlap? In this video, we solve LeetCode 836 - Rectangle Overlap using a simple trick: instead of checking when rectangles overlap, we check the 4 ways they can be completely separate and negate the result. We cover: Intuition behind rectangle overlap The 4 non-overlapping cases Why less than equal to and greater than equal to matter when rectangles only touch Clean C++ solution Time and space complexity Complexity: Time: O(1) Space: O(1) If you find this solution useful, like and subscribe for more LeetCode and software engineering explanations. EdgeCaseOffByOne:    / @edgecaseoffbyone   #LeetCode #LeetCode836 #RectangleOverlap #CodingInterview #DSA #CPlusPlus #Programming #SoftwareEngineering #EdgeCaseOffByOne #DailyProblem