File tree 9 files changed +55
-23
lines changed
9 files changed +55
-23
lines changed Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ # Counts the number of rehearsal files in each section
3
+ set -euo pipefail
4
+
5
+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
6
+ # shellcheck source=.github/scripts/sections.sh
7
+ source " ${SCRIPT_DIR} /sections.sh"
8
+
9
+ ALL_TESTS=0
10
+ # shellcheck disable=SC2154
11
+ for section in " ${sections[@]} " ; do
12
+ SECTION_TESTS=$( find " ${section} " -name " *_test.go" | wc -l)
13
+ ALL_TESTS=$(( ALL_TESTS + SECTION_TESTS))
14
+ done
15
+ echo $ALL_TESTS
Original file line number Diff line number Diff line change 1
1
#! /usr/bin/env bash
2
+ # Exports the markdown files from the docs site
2
3
set -euo pipefail
3
4
4
- # This script is used to export the markdown files from the docs site
5
+ SCRIPT_DIR=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd)
6
+ # shellcheck source=./.github/scripts/sections.sh
7
+ source " ${SCRIPT_DIR} /sections.sh"
8
+
5
9
declare -a files=(
6
10
README.md
7
11
complexity.md
8
- ./array/README.md
9
- ./strings/README.md
10
- ./linkedlist/README.md
11
- ./stack/README.md
12
- ./queue/README.md
13
- ./hashtable/README.md
14
- ./tree/README.md
15
- ./heap/README.md
16
- ./recursion/README.md
17
- ./dnc//README.md
18
- ./bit//README.md
19
- ./backtracking/README.md
20
- ./graph/README.md
21
- ./greedy/README.md
22
- ./dp/README.md
23
12
)
13
+ files+=(" ${sections[@]/%// README.md} " )
24
14
25
15
for file in " ${files[@]} " ; do
26
16
cat " $file "
Original file line number Diff line number Diff line change
1
+ #! /usr/bin/env bash
2
+ set -euo pipefail
3
+
4
+ declare -a sections=(
5
+ ./array
6
+ ./strings
7
+ ./linkedlist
8
+ ./stack
9
+ ./queue
10
+ ./hashtable
11
+ ./tree
12
+ ./heap
13
+ ./recursion
14
+ ./dnc
15
+ ./bit
16
+ ./backtracking
17
+ ./graph
18
+ ./greedy
19
+ ./dp
20
+ )
21
+
22
+ export sections
Original file line number Diff line number Diff line change 11
11
runs-on : ubuntu-latest
12
12
steps :
13
13
- uses : actions/checkout@v3
14
+ - uses : reviewdog/action-misspell@v1
15
+ with :
16
+ github_token : ${{ secrets.github_token }}
17
+ locale : " US"
14
18
- uses : github/super-linter@v4
15
19
env :
16
20
DEFAULT_BRANCH : main
22
26
YAML_CONFIG_FILE : .yamllint.yml
23
27
VALIDATE_GITLEAKS : false
24
28
LOG_LEVEL : WARN
25
- - uses : reviewdog/action-misspell@v1
26
- with :
27
- github_token : ${{ secrets.github_token }}
28
- locale : " US"
29
+ VALIDATE_SHELL_SHFMT : false
29
30
tests :
30
31
runs-on : ubuntu-latest
31
32
steps :
37
38
~/.cache/go-build
38
39
~/go/pkg/
39
40
~/go/bin/
40
- key : go-cache-${{ hashFiles('go.sum ') }}
41
+ key : go-cache-${{ hashFiles('go.mod ') }}
41
42
- run : go test -v -coverprofile=profile.cov ./...
42
43
- uses : shogo82148/actions-goveralls@v1
43
44
with :
Original file line number Diff line number Diff line change @@ -2,13 +2,14 @@ package greedy
2
2
3
3
import "sort"
4
4
5
+ // Event represents an event to be scheduled.
5
6
type Event struct {
6
7
Name string
7
8
StartTime int
8
9
EndTime int
9
10
}
10
11
11
- // Solves the problem in O(n*Log n) time and O(1) space.
12
+ // ScheduleEvents Solves the problem in O(n*Log n) time and O(1) space.
12
13
func ScheduleEvents (events []Event ) []Event {
13
14
sort .Slice (events , func (i , j int ) bool {
14
15
return events [i ].EndTime < events [j ].EndTime
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ func HeapSort(list []int) []int {
31
31
return sorted
32
32
}
33
33
34
- // Returns a new Min Heap.
34
+ // NewMinHeap Returns a new Min Heap.
35
35
func NewMinHeap () * MinHeap {
36
36
return & MinHeap {
37
37
Data : []* Vertex {},
Original file line number Diff line number Diff line change @@ -12,6 +12,7 @@ type UsingCircularArray struct {
12
12
13
13
const emptyValue = 0
14
14
15
+ // ErrQueueAtMaxCapacity occurs when the queue is at max capacity.
15
16
var ErrQueueAtMaxCapacity = errors .New ("queue is at max capacity" )
16
17
17
18
// NewCircularQueue returns a fixed size circular queue.
Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ type evaluation struct {
8
8
stack []float64
9
9
}
10
10
11
+ // ErrImbalancedParentheses occurs when the expression has imbalanced parentheses.
11
12
var ErrImbalancedParentheses = errors .New ("expression has imbalanced parentheses" )
12
13
13
14
// BasicCalculator solves the problem in O(n) time and O(n) space.
Original file line number Diff line number Diff line change 11
11
`i` : true ,
12
12
`u` : true ,
13
13
}
14
+ // ErrPopStack is returned when the stack is empty.
14
15
ErrPopStack = errors .New ("can not Pop on an empty stack" )
15
16
)
16
17
You can’t perform that action at this time.
0 commit comments