Rust/Python linear, just track max area and max diagonal
Intuition\nMaintain the maximum area/diagonal you found so far and change them if better result was found. No need to handle floating point as you can compare d
# Intuition\nMaintain the maximum area/diagonal you found so far and change them if better result was found. No need to handle floating point as you can compare diagonal squared.\n\n# Complexity\n- Time complexity: $O(n)$\n- Space complexity: $O(1)$\n\n# Code\n```Python []\nclass Solution:\n  def areaOfMaxDiagonal(self, dimensions: List[List[int]]) -> int:\n    max_d, max_a = 0, 0\n    for w, h in dimensions:\n      d = w ** 2 + h ** 2\n      if d > max_d:\n        max_d = d\n        max_a = w * h\n      elif d == max_d and w * h > max_a:\n        max_a = w * h\n    \n    return max_a\n```\n```Rust []\nimpl Solution {\n  pub fn area_of_max_diagonal(dimensions: Vec<Vec<i32>>) -> i32 {\n    let (mut max_d, mut max_a) = (0, 0);\n    for v in dimensions {\n      let d = v[0] * v[0] + v[1] * v[1];\n      if d > max_d {\n        max_d = d;\n        max_a = v[0] * v[1];\n      } else if d == max_d && max_a < v[0] * v[1] {\n        max_a = v[0] * v[1];\n      }\n    }\n    return max_a;\n  }\n}\n```
['Python', 'Rust']