problem
solution
事先算好 dominator 與 其次數,再不斷地計算兩區間的dominator個數是否大於其區間大小
1 | // you can use includes, for example: |
analysis
- time complexity
O(n)
- space complexity
O(1)
事先算好 dominator 與 其次數,再不斷地計算兩區間的dominator個數是否大於其區間大小
1 | // you can use includes, for example: |
O(n)
O(1)