File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -8,14 +8,14 @@ public int substringAnagrams(String s, String t) {
8
8
int [] windowFreqs = new int [26 ];
9
9
// Populate 'expected_freqs' with the characters in string 't'.
10
10
for (char c : t .toCharArray ()) {
11
- expectedFreqs [c - 'a' ] += 1 ;
11
+ expectedFreqs [c - 'a' ]++ ;
12
12
}
13
13
int left , right ;
14
14
left = right = 0 ;
15
15
while (right < lenS ) {
16
16
// Add the character at the right pointer to 'window_freqs'
17
17
// before sliding the window.
18
- windowFreqs [s .charAt (right ) - 'a' ] += 1 ;
18
+ windowFreqs [s .charAt (right ) - 'a' ]++ ;
19
19
// If the window has reached the expected fixed length, we
20
20
// advance the left pointer as well as the right pointer to
21
21
// slide the window.
@@ -25,7 +25,7 @@ public int substringAnagrams(String s, String t) {
25
25
}
26
26
// Remove the character at the left pointer from
27
27
// 'window_freqs' before advancing the left pointer.
28
- windowFreqs [s .charAt (left ) - 'a' ] -= 1 ;
28
+ windowFreqs [s .charAt (left ) - 'a' ]-- ;
29
29
left += 1 ;
30
30
}
31
31
right += 1 ;
You can’t perform that action at this time.
0 commit comments