Clean Kotlin solution
Complexity\n- Time complexity:\nO(n^2)\n\n- Space complexity:\nO()\n\n# Code\n\nclass Solution {\n\n    // O(n^2) time O(1) space\n    fun largestSquareArea(bot
# Complexity\n- Time complexity:\n$$O(n^2)$$\n\n- Space complexity:\n$$O()$$\n\n# Code\n```\nclass Solution {\n\n    // O(n^2) time O(1) space\n    fun largestSquareArea(bottomLeft: Array<IntArray>, topRight: Array<IntArray>): Long {\n        var result = 0L\n        for (i in 0..bottomLeft.size-2) {\n            for (j in i+1..bottomLeft.size-1) {\n                result = kotlin.math.max(\n                    result,\n                    intersectionSquareArea(bottomLeft[i], topRight[i], bottomLeft[j], topRight[j])\n                )\n            }\n        }\n        return result\n    }\n\n    // ----O\n    //   0-----\n\n    // ----\n    //  0O\n    \n    //     0--\n    //  ----O\n\n    // ---O\n    //       0------\n\n    //       0--\n    // --O\n\n    // intersection = min end (O) - max start (0) \n    private fun intersectionSquareArea(\n        bottomLeftFirst: IntArray, topRightFirst: IntArray,\n        bottomLeftSecond: IntArray, topRightSecond: IntArray,\n    ): Long {\n        val xIntersection = \n            kotlin.math.min(topRightFirst.x(), topRightSecond.x()) - \n            kotlin.math.max(bottomLeftFirst.x(), bottomLeftSecond.x())\n        if (xIntersection <= 0) return 0\n\n        val yIntersection = \n            kotlin.math.min(topRightFirst.y(), topRightSecond.y()) - \n            kotlin.math.max(bottomLeftFirst.y(), bottomLeftSecond.y())\n        if (yIntersection <= 0) return 0\n\n        val squareSize: Int = kotlin.math.min(xIntersection, yIntersection)\n        return squareSize.toLong() * squareSize\n    }\n\n    private fun IntArray.x() = this[0]\n    private fun IntArray.y() = this[1]\n}\n```
['Kotlin']