0ms| 1-liner C++ Py3|1344. Angle Between Hands of a Clock
應徵程式設計師,也會問小學數學,不用懷疑。
-----
When applying for a programmer position, they'll ask you elementary school math questions, no doubt about it.
#leetcode #1liner #cplusplus #python #leetcode1344
[Py3 1-liner請進]
[codes in Leetcode]https://leetcode.com/problems/angle-between-hands-of-a-clock/solutions/8340868/min360-ans-ansbeats-100-by-anwendeng-6u9r/
#anwendeng
class Solution:
def angleClock(self, h: int, m: int) -> float:
return 360-A if (A:=max(h*30.0, m*5.5)-min(h*30.0, m*5.5))>180 else A
沒有留言:
張貼留言
HTML 編輯器