網頁

2025年11月9日 星期日

C++ Py3 Euclidean Algorithm解Leetcode 2169 Count Operations to Obtain Zero


C++ Py3 Euclidean Algorithm解Leetcode 2169  Count Operations to Obtain Zero
[Py3一行解請進]

class Solution:
    def countOperations(self, x: int, y: int) -> int:
        return 0 if y==0 else x//y+self.countOperations(y, x%y)
        

沒有留言:

張貼留言

HTML 編輯器