herrDeng網內搜尋

自訂搜尋

Ads

2024年3月1日 星期五

C++ 2行Python 1行解Leetcode 2864 Maximum Odd Binary Number


Leetcode 2864. Maximum Odd Binary Number問題,要想寫出一行解也不是那麼容易,C++合理的二行解、python的一行解。要點先數幾個1再重填字串,另外還有使用兩個游標的解法,未在影片中。
----
Leetcode 2864. Maximum Odd Binary Number problem, it is not so easy to write a one-line solution, a reasonable two-line solution in C++, and a one-line solution in python. The key point is to count  1 before refilling the string. There is also a solution using two pointers, which is not in the video.

沒有留言:

Related Posts Plugin for WordPress, Blogger...

熱門文章