Skip to content

Commit 94e3a64

Browse files
committed
2022/06 comment
1 parent 20f67ff commit 94e3a64

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

2022/Day06/Solution.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,10 @@ class Solution : Solver {
88

99
public object PartOne(string input) => StartOfBlock(input, 4);
1010
public object PartTwo(string input) => StartOfBlock(input, 14);
11+
12+
// Slides a window of length l over the input and finds the first position
13+
// where each character is different. Returns the right of the window.
1114
int StartOfBlock(string input, int l) =>
1215
Enumerable.Range(l, input.Length)
13-
.First(i => input.Substring(i-l, l).ToHashSet().Count == l);
16+
.First(i => input.Substring(i - l, l).ToHashSet().Count == l);
1417
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy