Skip to content

Commit

Permalink
Update Readme.md
Browse files Browse the repository at this point in the history
  • Loading branch information
wisdompeak authored Oct 17, 2021
1 parent f9ae020 commit 795e9a4
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@
#### 方法2:
类似1918,我们也可以用双指针的单调性来实现o(n)的```countSmallerOrEqual(m)```,不过讨论起来就更复杂了。

```nums[i]* nums[j] <= m```

1. m>=0
(i) nums[i]>0: 我们有 nums2[j] <= m/nums1[i]。可以知道nums2[j]有个上界,且随着nums1[i]的增大,这个上界越来越小。所以我们从大到小单调地移动j,找到与i对应的临界位置j,那么[0:j]都是合法的解。
(ii) nums[i]==0: 所有的nums2都是解。
Expand Down

0 comments on commit 795e9a4

Please sign in to comment.