C++雙指標與二元搜尋解Leetcode 2540 Minimum Common Value
陣列已排序。 使用雙指標或使用二元搜尋找來解它
----
Arrays are sorted. Solve it either using 2 pointers or using binary search
2nd approach uses binary search which is efficient when either n1 or n2 is very large and the other is small.
[codes on Leetcode]https://leetcode.com/problems/minimum-common-value/solutions/4845113/2-pointers-linear-sol-vs-binary-search24ms-beats-9987/
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
沒有留言:
張貼留言