본문 바로가기
IT/알고리즘

71] Leetcode 2469. Convert the Temperature

by 깻잎쌈 2023. 4. 4.
반응형

https://leetcode.com/problems/convert-the-temperature/description/

 

Convert the Temperature - LeetCode

Can you solve this real interview question? Convert the Temperature - You are given a non-negative floating point number rounded to two decimal places celsius, that denotes the temperature in Celsius. You should convert Celsius into Kelvin and Fahrenheit a

leetcode.com

주어진 값을 수식에 맞게 변형 후 리턴하는 문제

class Solution {
    fun convertTemperature(celsius: Double): DoubleArray {

        val ans = DoubleArray(2)

        ans[0] = celsius + 273.15
        ans[1] = celsius * 1.80 + 32.00 


        return ans;
    }
}
반응형

댓글