Simplest Code: Beats 100%
IntuitionApproachComplexity
Time complexity: O(n)

Space complexity: O(1)
Code
# Intuition
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
<!-- Describe your approach to solving the problem. -->

# Complexity
- Time complexity: O(n)
<!-- Add your time complexity here, e.g. $$O(n)$$ -->

- Space complexity: O(1)
<!-- Add your space complexity here, e.g. $$O(n)$$ -->

# Code
```cpp []
class Solution {
public:
    int areaOfMaxDiagonal(vector<vector<int>>& d) {
        double maxi = 0.0;
        int area = 0;

        // Iterate through all rectangles
        for (int i = 0; i < d.size(); i++) {
            int l = d[i][0], b = d[i][1];

            // Calculate diagonal
            double val = (l * l) + (b * b);
            double diag = sqrt(val);

            // Update the maximum diagonal and area
            if (diag > maxi) {
                maxi = diag;
                area = l * b;  // Update area for the new maximum diagonal
            }else if (diag == maxi) {
               area = max(area, l * b);  // Update area for same maximum diagonal
           }
        }

        return area;
    }
};

```
['C++']