Maximum Area of Longest Diagonal
Intuition
I have to create a 2 variable length and index
Whatever DiagonalLength will I get I have to compare it with my length
Approach
Create a 2 variable Len
# Intuition
1. I have to create a 2 variable length and index
2. Whatever DiagonalLength will I get I have to compare it with my length
<!-- Describe your first thoughts on how to solve this problem. -->

# Approach
1. Create a 2 variable Length and index
2. First Iterate the outer loop till N and Inner Loop till N - 1 because we are having 2 elements in inner array will run it once
3. As per given formula in question Math.sqrt(element1 * element1 + element2 * element2) because to satisfy this condition I have run the inner loop Once
4. After Getting DiagonalLength I have compared it with my Length Variable and if it less than I have stored the DiagonalLength and index.
5. Edge Case => if Length === DiagonalLength
6. I have created newArea and compared it with the area I have stored in outer loop if it is less than I have replace my new area with old area and changed the index also
<!-- Describe your approach to solving the problem. -->

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

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

# Code
```javascript []
/**
 * @param {number[][]} dimensions
 * @return {number}
 */
var areaOfMaxDiagonal = function(dimensions) {
    
    //Creating a variable to store greatest value of diagonal
    let Length = 0
    let index = 0

    for (let i = 0; i < dimensions.length; i++) {

        // Storing the area there to compare during edge case -> if length === diagonalLength
        let area = dimensions[index][0] * dimensions[index][1]

        for (let j = 0; j < dimensions[i].length - 1; j++) {

            let DiagonalLength = Math.sqrt(Math.pow(dimensions[i][j], 2) + Math.pow(dimensions[i][j+1], 2))

            // Now I am comparing the Length
            if (Length < DiagonalLength) {
                Length = DiagonalLength;
                index = i
            }

            if (Length === DiagonalLength) {

                // find the area of current element and compare it with previous ones
                newArea = dimensions[i][j] * dimensions[i][j+1]

                // Now Compare the newArea and previous Area 
                if (area < newArea) {
                    area = newArea;
                    index = i
                }
            }

        }
    }

    return (dimensions[index][0] * dimensions[index][1])
};
```
['JavaScript']