problem
solution
option 1
不斷向右shift ,直到兩數字相等
1 | class Solution { |
option 2
概念與option 1一樣,答案必定為2的指數
1 | class Solution { |
analysis
- time complexity
O(logn)
- space complexity
O(1)
不斷向右shift ,直到兩數字相等
1 | class Solution { |
概念與option 1一樣,答案必定為2的指數
1 | class Solution { |
O(logn)
O(1)