0 ms | 29.22 MB -> 92.25% | Readable
\n\n# Code\ncpp []\nclass Solution {\npublic:\n    int areaOfMaxDiagonal(vector<vector<int>>& dimensions) {\n        unsigned short int maxSum = 0;\n        uns
![ev4.png](https://assets.leetcode.com/users/images/22854d9f-d610-42be-973f-a4bb13abe5fe_1731285621.138953.png)\n\n# Code\n```cpp []\nclass Solution {\npublic:\n    int areaOfMaxDiagonal(vector<vector<int>>& dimensions) {\n        unsigned short int maxSum = 0;\n        unsigned char maxIndex = 0;\n        unsigned short int sum = 0;\n        unsigned char lenght = dimensions.size();\n\n        for (unsigned char i = 0; i < lenght; i++) {\n            sum = (dimensions[i][0] * dimensions[i][0]) + (dimensions[i][1] * dimensions[i][1]);\n            if (sum > maxSum) {\n                maxSum = sum;\n                maxIndex = i;\n            } else if (sum == maxSum) {\n                if (dimensions[i][0] * dimensions[i][1] > dimensions[maxIndex][0] * dimensions[maxIndex][1]) {\n                    maxIndex = i;\n                }\n            }\n        }\n\n        return dimensions[maxIndex][0] * dimensions[maxIndex][1];\n    }\n};\n```
['C++']