herrDeng網內搜尋

自訂搜尋

Ads

2025年7月4日 星期五

Py3 C++位元計算bitset速解Leetcode難題3307 Find the K th Character in String Gam...

Py3 C++位元計算bitset速解Leetcode難題3307  Find the K th Character in String Game II
[Py3 一行解請進]
class Solution:
    def kthCharacter(self, k: int, operations: List[int]) -> str:
        return chr(97+((k-1) & sum(operations[b]<<b for b in range((k-1).bit_length()))).bit_count()%26)

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章