Skip to content

Commit

Permalink
2182
Browse files Browse the repository at this point in the history
  • Loading branch information
lzl124631x committed Feb 20, 2022
1 parent 733ce1a commit 717a4cd
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion leetcode/2182. Construct String With Repeat Limit/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,4 +84,18 @@ public:
```
## Discuss
https://leetcode.com/problems/construct-string-with-repeat-limit/discuss/1784718
https://leetcode.com/problems/construct-string-with-repeat-limit/discuss/1784718
## Note
I saw some code with the following loops
```cpp
for (int i = 1; i <= 100000; ++i) {
for (int j = i; j <= 100000; j += i) {
// Some O(1) operation
}
}
```

The time complexity of these loops is roughly `O(NlogN)`. Because `1/1+1/2+...+1/N` is roughly `logN`. See https://math.stackexchange.com/questions/3367037/sum-of-1-1-2-1-3-1-n

0 comments on commit 717a4cd

Please sign in to comment.