Skip to content

Commit 64f72bd

Browse files
committed
Fix table formatting in explanations
1 parent 49940ef commit 64f72bd

File tree

11 files changed

+71
-71
lines changed

11 files changed

+71
-71
lines changed

explanations/3531/en.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,13 @@ We check each building to see if it's covered.
4848

4949
**2.3 Trace Walkthrough:**
5050

51-
| Step | Building | x-group | y-group | Above? | Below? | Left? | Right? | Covered? |
52-
|------|----------|---------|---------|--------|--------|-------|--------|----------|
53-
| 1 | [1,2] | [2] | [1,2,3] | No (min=2) | No (max=2) | No (min=1) | Yes (max=3) | No |
54-
| 2 | [2,2] | [1,2,3] | [1,2,3] | Yes (min=1<2) | Yes (max=3>2) | Yes (min=1<2) | Yes (max=3>2) | Yes |
55-
| 3 | [3,2] | [2] | [1,2,3] | No (min=2) | No (max=2) | Yes (min=1<3) | No (max=3) | No |
56-
| 4 | [2,1] | [1,2,3] | [2] | No (min=1) | Yes (max=3>1) | No (min=2) | No (max=2) | No |
57-
| 5 | [2,3] | [1,2,3] | [2] | Yes (min=1<3) | No (max=3) | No (min=2) | No (max=2) | No |
51+
| Step | Building | x-group | y-group | Above? | Below? | Left? | Right? | Covered? |
52+
| ---- | -------- | ------- | ------- | ------------- | ------------- | ------------- | ------------- | -------- |
53+
| 1 | [1,2] | [2] | [1,2,3] | No (min=2) | No (max=2) | No (min=1) | Yes (max=3) | No |
54+
| 2 | [2,2] | [1,2,3] | [1,2,3] | Yes (min=1<2) | Yes (max=3>2) | Yes (min=1<2) | Yes (max=3>2) | Yes |
55+
| 3 | [3,2] | [2] | [1,2,3] | No (min=2) | No (max=2) | Yes (min=1<3) | No (max=3) | No |
56+
| 4 | [2,1] | [1,2,3] | [2] | No (min=1) | Yes (max=3>1) | No (min=2) | No (max=2) | No |
57+
| 5 | [2,3] | [1,2,3] | [2] | Yes (min=1<3) | No (max=3) | No (min=2) | No (max=2) | No |
5858

5959
At step 2, building [2,2] is covered because it has buildings in all four directions.
6060

explanations/3702/en.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,11 @@ We calculate the XOR of all elements: `total_xor = 1 XOR 2 XOR 3 = 0`.
4747

4848
**2.3 Trace Walkthrough:**
4949

50-
| Step | Action | total_xor | Result |
51-
|------|--------|-----------|--------|
52-
| 1 | Calculate total XOR | 1 XOR 2 XOR 3 = 0 | - |
53-
| 2 | Check if non-zero | 0 (zero) | Try removing elements |
54-
| 3 | Remove nums[0]=1 | 0 XOR 1 = 1 | Found! Return 2 |
50+
| Step | Action | total_xor | Result |
51+
| ---- | ------------------- | ----------------- | --------------------- |
52+
| 1 | Calculate total XOR | 1 XOR 2 XOR 3 = 0 | - |
53+
| 2 | Check if non-zero | 0 (zero) | Try removing elements |
54+
| 3 | Remove nums[0]=1 | 0 XOR 1 = 1 | Found! Return 2 |
5555

5656
At step 3, we find that removing element 1 gives XOR = 1 (non-zero), so we return n-1 = 2.
5757

explanations/3703/en.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,10 +46,10 @@ We process each character in the string, grouping consecutive characters.
4646

4747
**2.3 Trace Walkthrough:**
4848

49-
| Step | char | st before | st after | Action |
50-
|------|------|-----------|----------|--------|
51-
| 1 | '(' | [] | [['(',1]] | Add new group |
52-
| 2 | '(' | [['(',1]] | [['(',2]] | Increment count |
49+
| Step | char | st before | st after | Action |
50+
| ---- | ---- | --------- | ----------------- | ----------------------------------------------------- |
51+
| 1 | '(' | [] | [['(',1]] | Add new group |
52+
| 2 | '(' | [['(',1]] | [['(',2]] | Increment count |
5353
| 3 | ')' | [['(',2]] | [['(',2],[')',1]] | Add new group, check: remove k=1 from '(', remove ')' |
5454
| 4 | ')' | [['(',1]] | [['(',1],[')',1]] | Add new group, check: remove k=1 from '(', remove ')' |
5555

explanations/3708/en.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ We iterate from index 2 onwards, checking if each element extends the Fibonacci
4848

4949
**2.3 Trace Walkthrough:**
5050

51-
| Step | i | nums[i] | nums[i-1]+nums[i-2] | Match? | current_length | res |
52-
|------|---|---------|---------------------|--------|----------------|-----|
53-
| 1 | 2 | 1 | 1+1=2 | No | 2 | 2 |
54-
| 2 | 3 | 1 | 1+1=2 | No | 2 | 2 |
55-
| 3 | 4 | 2 | 1+1=2 | Yes | 3 | 2 |
56-
| 4 | 5 | 3 | 2+1=3 | Yes | 4 | 2 |
57-
| 5 | 6 | 5 | 3+2=5 | Yes | 5 | 2 |
58-
| 6 | 7 | 1 | 5+3=8 | No | 2 | 5 |
51+
| Step | i | nums[i] | nums[i-1]+nums[i-2] | Match? | current_length | res |
52+
| ---- | --- | ------- | ------------------- | ------ | -------------- | --- |
53+
| 1 | 2 | 1 | 1+1=2 | No | 2 | 2 |
54+
| 2 | 3 | 1 | 1+1=2 | No | 2 | 2 |
55+
| 3 | 4 | 2 | 1+1=2 | Yes | 3 | 2 |
56+
| 4 | 5 | 3 | 2+1=3 | Yes | 4 | 2 |
57+
| 5 | 6 | 5 | 3+2=5 | Yes | 5 | 2 |
58+
| 6 | 7 | 1 | 5+3=8 | No | 2 | 5 |
5959

6060
At step 5, we find the longest Fibonacci subarray [1, 1, 2, 3, 5] with length 5.
6161

explanations/3709/en.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ We record exams and update our data structures.
5252

5353
**2.3 Trace Walkthrough:**
5454

55-
| Step | Operation | times | scores | prefix_sum | Result |
56-
|------|-----------|-------|--------|------------|--------|
57-
| 1 | record(1,98) | [1] | [98] | [0,98] | - |
58-
| 2 | totalScore(1,1) | [1] | [98] | [0,98] | 98 (prefix_sum[1]-prefix_sum[0]) |
59-
| 3 | record(5,99) | [1,5] | [98,99] | [0,98,197] | - |
55+
| Step | Operation | times | scores | prefix_sum | Result |
56+
| ---- | --------------- | ----- | ------- | ---------- | --------------------------------- |
57+
| 1 | record(1,98) | [1] | [98] | [0,98] | - |
58+
| 2 | totalScore(1,1) | [1] | [98] | [0,98] | 98 (prefix_sum[1]-prefix_sum[0]) |
59+
| 3 | record(5,99) | [1,5] | [98,99] | [0,98,197] | - |
6060
| 4 | totalScore(1,5) | [1,5] | [98,99] | [0,98,197] | 197 (prefix_sum[2]-prefix_sum[0]) |
6161

6262
At step 4, binary search finds left=0 (first time >= 1) and right=2 (first time > 5), so we return prefix_sum[2] - prefix_sum[0] = 197.

explanations/3713/en.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -47,13 +47,13 @@ We iterate through each starting position i from 0 to n-1.
4747

4848
**2.3 Trace Walkthrough:**
4949

50-
| Step | i | j | s[j] | char_count | distinct_chars | counts | Balanced? | res |
51-
|------|---|---|------|------------|----------------|--------|-----------|-----|
52-
| 1 | 0 | 0 | 'a' | {a:1} | ['a'] | [1] | Yes | 1 |
53-
| 2 | 0 | 1 | 'b' | {a:1,b:1} | ['a','b'] | [1,1] | Yes | 2 |
54-
| 3 | 0 | 2 | 'b' | {a:1,b:2} | ['a','b'] | [1,2] | No | 2 |
55-
| 4 | 0 | 3 | 'a' | {a:2,b:2} | ['a','b'] | [2,2] | Yes | 4 |
56-
| 5 | 0 | 4 | 'c' | {a:2,b:2,c:1} | ['a','b','c'] | [2,2,1] | No | 4 |
50+
| Step | i | j | s[j] | char_count | distinct_chars | counts | Balanced? | res |
51+
| ---- | --- | --- | ---- | ------------- | -------------- | ------- | --------- | --- |
52+
| 1 | 0 | 0 | 'a' | {a:1} | ['a'] | [1] | Yes | 1 |
53+
| 2 | 0 | 1 | 'b' | {a:1,b:1} | ['a','b'] | [1,1] | Yes | 2 |
54+
| 3 | 0 | 2 | 'b' | {a:1,b:2} | ['a','b'] | [1,2] | No | 2 |
55+
| 4 | 0 | 3 | 'a' | {a:2,b:2} | ['a','b'] | [2,2] | Yes | 4 |
56+
| 5 | 0 | 4 | 'c' | {a:2,b:2,c:1} | ['a','b','c'] | [2,2,1] | No | 4 |
5757

5858
At step 4, we find the longest balanced substring "abba" with length 4, where both 'a' and 'b' appear twice.
5959

explanations/3714/en.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -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

6060
At 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

explanations/3719/en.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,15 @@ We iterate through each starting position i from 0 to n-1.
4747

4848
**2.3 Trace Walkthrough:**
4949

50-
| Step | i | j | nums[j] | even_set | odd_set | Balanced? | res |
51-
|------|---|---|---------|----------|---------|-----------|-----|
52-
| 1 | 0 | 0 | 2 | {2} | {} | No | 0 |
53-
| 2 | 0 | 1 | 5 | {2} | {5} | Yes (1==1)| 2 |
54-
| 3 | 0 | 2 | 4 | {2,4} | {5} | No | 2 |
55-
| 4 | 0 | 3 | 3 | {2,4} | {5,3} | Yes (2==2)| 4 |
56-
| 5 | 1 | 1 | 5 | {} | {5} | No | 4 |
57-
| 6 | 1 | 2 | 4 | {4} | {5} | Yes (1==1)| 4 |
58-
| 7 | 1 | 3 | 3 | {4} | {5,3} | No | 4 |
50+
| Step | i | j | nums[j] | even_set | odd_set | Balanced? | res |
51+
| ---- | --- | --- | ------- | -------- | ------- | ---------- | --- |
52+
| 1 | 0 | 0 | 2 | {2} | {} | No | 0 |
53+
| 2 | 0 | 1 | 5 | {2} | {5} | Yes (1==1) | 2 |
54+
| 3 | 0 | 2 | 4 | {2,4} | {5} | No | 2 |
55+
| 4 | 0 | 3 | 3 | {2,4} | {5,3} | Yes (2==2) | 4 |
56+
| 5 | 1 | 1 | 5 | {} | {5} | No | 4 |
57+
| 6 | 1 | 2 | 4 | {4} | {5} | Yes (1==1) | 4 |
58+
| 7 | 1 | 3 | 3 | {4} | {5,3} | No | 4 |
5959

6060
At step 4, we find the longest balanced subarray [2, 5, 4, 3] with length 4.
6161

explanations/3720/en.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,14 +48,14 @@ We call `backtrack([], cnt, False)` to start building the permutation.
4848

4949
**2.3 Trace Walkthrough:**
5050

51-
| Step | pos | char tried | big | path | Action |
52-
|------|-----|------------|-----|------|--------|
53-
| 1 | 0 | 'a' | False | ['a'] | Skip (a < 'b') |
54-
| 2 | 0 | 'b' | False | ['b'] | Continue (b == 'b') |
55-
| 3 | 1 | 'a' | False | ['b','a'] | Skip (ba < bba) |
56-
| 4 | 1 | 'b' | False | ['b','b'] | Continue (bb == bb) |
51+
| Step | pos | char tried | big | path | Action |
52+
| ---- | --- | ---------- | ----- | ------------- | -------------------- |
53+
| 1 | 0 | 'a' | False | ['a'] | Skip (a < 'b') |
54+
| 2 | 0 | 'b' | False | ['b'] | Continue (b == 'b') |
55+
| 3 | 1 | 'a' | False | ['b','a'] | Skip (ba < bba) |
56+
| 4 | 1 | 'b' | False | ['b','b'] | Continue (bb == bb) |
5757
| 5 | 2 | 'a' | False | ['b','b','a'] | Skip (bba not > bba) |
58-
| 6 | 2 | 'c' | True | ['b','c'] | Found! Return "bca" |
58+
| 6 | 2 | 'c' | True | ['b','c'] | Found! Return "bca" |
5959

6060
At step 6, we find that "bca" > "bba", so we return it.
6161

explanations/3724/en.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,10 +48,10 @@ We try each possible position j to append.
4848

4949
**2.3 Trace Walkthrough:**
5050

51-
| Step | j | nums1[j] | nums2[j] | last_target | current | median | adjust_cost | total | res |
52-
|------|---|----------|----------|-------------|---------|--------|-------------|-------|-----|
53-
| 1 | 0 | 2 | 1 | 3 | 2-1=1 | 2 | |2-2|+|1-2|+|3-2|=2 | 1+2+1=4 | 4 |
54-
| 2 | 1 | 8 | 7 | 3 | 2-1=1 | 7 | |8-7|+|7-7|+|3-7|=8 | 1+8+1=10 | 4 |
51+
| Step | j | nums1[j] | nums2[j] | last_target | current | median | adjust_cost | total | res |
52+
| ---- | --- | -------- | -------- | ----------- | ------- | ------ | ----------- | ----- | --- |
53+
| 1 | 0 | 2 | 1 | 3 | 2-1=1 | 2 | | 2-2 | + | 1-2 | + | 3-2 | =2 | 1+2+1=4 | 4 |
54+
| 2 | 1 | 8 | 7 | 3 | 2-1=1 | 7 | | 8-7 | + | 7-7 | + | 3-7 | =8 | 1+8+1=10 | 4 |
5555

5656
At step 1, we find the optimal cost is 4: adjust 2 to 2 (median), then adjust to 1 at position 0 and 3 at the end.
5757

0 commit comments

Comments
 (0)