Skip to content

Commit fbbe986

Browse files
committed
change README format
1 parent b692b1d commit fbbe986

2 files changed

Lines changed: 17 additions & 14 deletions

File tree

‎README.md‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ This repository contains solutions from AlgoExpert, LeetCode, and HackerRank in
44
Suggestions and contributions are welcome.
55

66
### [HackerRank](https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/HackerRank/)
7+
<!-- AUTO:START:HACKERRANK -->
78
| Serial No. | Problem | Solution | Time Complexity | Space Complexity | Notes |
89
|---|---|---|---|---|---|
9-
<!-- AUTO:START:HACKERRANK -->
1010
|1|3D Surface Area|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/HackerRank/3D%20Surface%20Area">Link</a>|_|_|_|
1111
|2|Almost Sorted|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/HackerRank/Almost%20Sorted">Link</a>|_|_|_|
1212
|3|Binary Search Trees|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/HackerRank/Binary%20Search%20Trees">Link</a>|_|_|_|
@@ -25,9 +25,9 @@ Suggestions and contributions are welcome.
2525
<!-- AUTO:END:HACKERRANK -->
2626

2727
### [LeetCode](https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/LeetCode/)
28+
<!-- AUTO:START:LEETCODE -->
2829
| Serial No. | Problem | Solution | Time Complexity | Space Complexity | Notes |
2930
|---|---|---|---|---|---|
30-
<!-- AUTO:START:LEETCODE -->
3131
|1|3 Sum Closest|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/LeetCode/3%20Sum%20Closest">Link</a>|_|_|_|
3232
|2|Add Strings|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/LeetCode/Add%20Strings">Link</a>|_|_|_|
3333
|3|Array Rotation|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/LeetCode/Array%20Rotation">Link</a>|_|_|_|
@@ -135,9 +135,9 @@ Suggestions and contributions are welcome.
135135
<!-- AUTO:END:LEETCODE -->
136136

137137
### [AlgoExpert](https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/AlgoExpert/)
138+
<!-- AUTO:START:ALGOEXPERT -->
138139
| Serial No. | Problem | Solution | Time Complexity | Space Complexity | Notes |
139140
|---|---|---|---|---|---|
140-
<!-- AUTO:START:ALGOEXPERT -->
141141
|1|Apartment Hunting|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/AlgoExpert/Apartment%20Hunting">Link</a>|_|_|_|
142142
|2|Array of Products|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/AlgoExpert/Array%20of%20Products">Link</a>|_|_|_|
143143
|3|BST Construction|<a href="https://github.com/boudhayan/Algorithm-Solutions-In-Swift/tree/main/AlgoExpert/BST%20Construction">Link</a>|_|_|_|

‎scripts/update-readme.sh‎

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,14 @@ trim_whitespace() {
2525
printf '%s' "$value"
2626
}
2727

28-
generate_rows() {
28+
generate_table() {
2929
local category="$1"
3030
local index=1
3131
local dir problem encoded_path link
3232

33+
printf '| Serial No. | Problem | Solution | Time Complexity | Space Complexity | Notes |\n'
34+
printf '|---|---|---|---|---|---|\n'
35+
3336
while IFS= read -r dir; do
3437
problem="$(basename "$dir")"
3538
problem="$(trim_whitespace "$problem")"
@@ -95,18 +98,18 @@ replace_section() {
9598
mv "$temp_file" "$readme_path"
9699
}
97100

98-
hackerrank_rows="$(mktemp)"
99-
leetcode_rows="$(mktemp)"
100-
algoexpert_rows="$(mktemp)"
101+
hackerrank_table="$(mktemp)"
102+
leetcode_table="$(mktemp)"
103+
algoexpert_table="$(mktemp)"
101104

102-
trap 'rm -f "$hackerrank_rows" "$leetcode_rows" "$algoexpert_rows"' EXIT
105+
trap 'rm -f "$hackerrank_table" "$leetcode_table" "$algoexpert_table"' EXIT
103106

104-
generate_rows "HackerRank" > "$hackerrank_rows"
105-
generate_rows "LeetCode" > "$leetcode_rows"
106-
generate_rows "AlgoExpert" > "$algoexpert_rows"
107+
generate_table "HackerRank" > "$hackerrank_table"
108+
generate_table "LeetCode" > "$leetcode_table"
109+
generate_table "AlgoExpert" > "$algoexpert_table"
107110

108-
replace_section "HACKERRANK" "$hackerrank_rows"
109-
replace_section "LEETCODE" "$leetcode_rows"
110-
replace_section "ALGOEXPERT" "$algoexpert_rows"
111+
replace_section "HACKERRANK" "$hackerrank_table"
112+
replace_section "LEETCODE" "$leetcode_table"
113+
replace_section "ALGOEXPERT" "$algoexpert_table"
111114

112115
echo "README.md updated from directory structure."

0 commit comments

Comments
 (0)