/* 自定義代碼塊樣式 */

herrDeng網內搜尋

自訂搜尋

Ads

2025年3月5日 星期三

Py3 C++算術數列算面積一行解Leetcode 2579 Count Total Number of Colored Cells


Py3 C++算術數列算面積一行解Leetcode 2579  Count Total Number of Colored Cells
利用算術數列面積公式一行解Leetcode 257
[Py3解請進]


2025年2月19日 星期三

C++py3排列組合與binary表達解Leetcode 1415 The k th Lexicographical String of Al...


C++py3排列組合與binary表達解Leetcode 1415  The k th Lexicographical String of All Happy Strings of Length n
總共有3*2^(n-1)個happy strings要求第k個。先算(k-1)除以2^(n-1)的商q與餘數r,s[0]由q決定,s[1:n]由r決定,化r為二進位,然後簡單處理一下就得解
[Py3解請進]

2025年2月14日 星期五

C++ OOP Prefix Product解Leetcode 1352 Product of the Last K Numbers


C++ OOP Prefix Product解Leetcode 1352  Product of the Last K Numbers
Leetcode這題1352. Product of the Last K Numbers,是很好的OOP題目,除了談談class之外,還能練習一下prefix product的概念(與prefix sum類似但要小心0)
[C++解請進]
Related Posts Plugin for WordPress, Blogger...

熱門文章