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.
[codes on Leetcode]https://leetcode.com/problems/maximum-odd-binary-number/solutions/4802356/c-2-line-vs-python-1-line-vs-c-2-pointers-in-place-0ms-beats-100/
[Leetcode playList]https://www.youtube.com/watch?v=WjrWkPysfRM&list=PLYRlUBnWnd5IdDHk2BjqXwesydU17z_xk
[Dynamic Programming Playlist]https://www.youtube.com/watch?v=30yq3fmE6E8&list=PLYRlUBnWnd5K_XYUesV9oc6M9ONXII61T
沒有留言:
張貼留言