✅beats 100% || compare square of diameter to avoid fractional inaccuracies
Intuition\n Describe your first thoughts on how to solve this problem. \n\n# Approach\nDo not find the square roots. Directly compare the square value of the\nd
# Intuition\n<!-- Describe your first thoughts on how to solve this problem. -->\n\n# Approach\nDo not find the square roots. Directly compare the square value of the\ndiagonal. This prevents fractional inacurracies that could occur while finding square root of non-perfect square numbers.\n\n(Please upvote if you found it helpful)\n\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\nclass Solution {\npublic:\n    int areaOfMaxDiagonal(vector<vector<int>>& d) {\n        \n        int maxarea = -1, l, b, maxdia = -1, dia;\n        \n        for(int i=0; i<d.size(); ++i)\n        {\n            l = d[i][0]; b = d[i][1];\n            dia = l*l + b*b;\n            \n            if(dia > maxdia)\n            {\n                maxdia = dia;\n                maxarea = l*b;\n            }\n            \n            else if(dia == maxdia)  //if length of diameter is same, then pick the maximum area among the two.\n            {\n                if(maxarea < l*b)\n                    maxarea = l*b;           \n            }\n        }\n        \n        return maxarea;\n    }\n};\n```
['C++']