@@ -48,14 +48,14 @@ We iterate through each prefix position i from 0 to n.
4848
4949** 2.3 Trace Walkthrough:**
5050
51- | Step | i | (a,b,c) | Case | Key | Check first | res |
52- | ------ | ---| --------- | ------ | -----| -------------| ----- |
53- | 1 | 0 | (0,0,0) | All | ("abc",0,0) | i=0 stored | 0 |
54- | 2 | 1 | (1,0,0) | All | ("abc",1,1) | i=1 stored | 0 |
55- | 3 | 2 | (1,1,0) | All | ("abc",0,1) | i=2 stored | 0 |
56- | 4 | 3 | (1,2,0) | All | ("abc",-1,1) | i=3 stored | 0 |
57- | 5 | 4 | (2,2,0) | All | ("abc",0,2) | Found i=2 | 2 |
58- | 6 | 4 | (2,2,0) | ab | ("ab",0,0) | Found i=0 | 4 |
51+ | Step | i | (a,b,c) | Case | Key | Check first | res |
52+ | ---- | --- | ------- | ---- | -- ---------- | ----------- | --- |
53+ | 1 | 0 | (0,0,0) | All | ("abc",0,0) | i=0 stored | 0 |
54+ | 2 | 1 | (1,0,0) | All | ("abc",1,1) | i=1 stored | 0 |
55+ | 3 | 2 | (1,1,0) | All | ("abc",0,1) | i=2 stored | 0 |
56+ | 4 | 3 | (1,2,0) | All | ("abc",-1,1) | i=3 stored | 0 |
57+ | 5 | 4 | (2,2,0) | All | ("abc",0,2) | Found i=2 | 2 |
58+ | 6 | 4 | (2,2,0) | ab | ("ab",0,0) | Found i=0 | 4 |
5959
6060At step 6, we find that positions 0 and 4 have the same (a-b, c) = (0, 0), meaning substring s[ 0:4] = "abba" is balanced for 'a' and 'b'.
6161
0 commit comments