Skip to content

Commit 151fb27

Browse files
committed
fixed typo in ShortestCoprimeSegment
1 parent c78dd46 commit 151fb27

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/main/java/com/thealgorithms/slidingwindow/ShortestCoprimeSegment.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
* In our case 'adding' is calculating d' = gcd(a[i],...,a[i+l+1]), when d = gcd(a[i],...a[i]) with d' = gcd(d, a[i+l+1]).
1717
* and removing is find gcd(a[i+1],...,a[i+l]). We don't calculate it explicitly, but it is pushed in the stack which we can pop in O(1).
1818
* <p>
19-
* One can change methods 'legalSegment' and function 'f' in DoubleStack to adapt this code to other Silding-window type problems.
19+
* One can change methods 'legalSegment' and function 'f' in DoubleStack to adapt this code to other sliding-window type problems.
2020
* I recommend this article for more explanations: <a href="https://codeforces.com/edu/course/2/lesson/9/2">Article 1</a> or https://usaco.guide/gold/sliding-window?lang=cpp#method-2---two-stacks
2121
* <p>
2222
* Another method to solve this problem is through segment trees. Then query operation would have O(log n), not O(1) time, but runtime complexity would still be O(n log n)

0 commit comments

Comments
 (0)