Skip to content

Commit 9e950c9

Browse files
authored
Merge pull request #318 from sir-gon/develop
Develop
2 parents fabaa21 + acd2843 commit 9e950c9

File tree

12 files changed

+31
-27
lines changed

12 files changed

+31
-27
lines changed

.github/workflows/go.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
fail-fast: false
2222
matrix:
2323
os: ["windows-2022", "ubuntu-24.04", "macos-14"]
24-
go: ['1.22.x', '1.23.x']
24+
go: ['1.22.x', '1.23.x', '1.24.x']
2525
runs-on: ${{ matrix.os }}
2626
steps:
2727
- uses: actions/checkout@v4
@@ -44,10 +44,10 @@ jobs:
4444
run: go vet -v ./...
4545

4646
- name: Lint golangci-lint
47-
uses: golangci/golangci-lint-action@v6
47+
uses: golangci/golangci-lint-action@v7
4848
with:
4949
args: --timeout=10m
50-
version: v1.60.3
50+
version: v2.0.0
5151
skip-cache: true
5252

5353
- name: Test

exercises/hackerrank/interview_preparation_kit/arrays/crush.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ func arrayManipulation(n int32, queries [][]int32) int64 {
88
// why adding 2?
99
// first slot to adjust 1-based index and
1010
// last slot for storing accumSum result
11-
var LENGTH int32 = n + 2
11+
var LENGTH = n + 2
1212
const InitialValue int64 = 0
1313
var maximum int64 = 0
1414

exercises/hackerrank/interview_preparation_kit/arrays/crush_bruteforce.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ package hackerrank
77
import "slices"
88

99
func arrayManipulationBruteForce(n int32, queries [][]int32) int64 {
10-
var LENGTH int32 = n + 1
10+
var LENGTH = n + 1
1111
const InitialValue int64 = 0
1212

1313
result := make([]int64, LENGTH)

exercises/hackerrank/interview_preparation_kit/arrays/minimum_swaps_2.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
package hackerrank
66

77
func minimumSwaps(arr []int32) int32 {
8-
var size int32 = int32(len(arr))
8+
var size = int32(len(arr))
99
var indexedGroup = make(map[int32]int32, size)
1010
var swaps int32 = 0
1111
var index int32 = 0

exercises/hackerrank/interview_preparation_kit/arrays/new_year_chaos.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/**
2-
* @link Problem definition [[docs/hackerrank/interview_preparation_kit/arrays/new_year_chaos.md]]
2+
* @link Problem definition [[docs/hackerrank/interview_preparation_kit/arrays/new_year_chaos.md]]
33
*/
44

55
package hackerrank
@@ -23,12 +23,12 @@ func minimumBribesCalculate(q []int32) (int32, error) {
2323
position := i + 1
2424

2525
if value-int32(position) > NEW_YEAR_CHAOS_TOLERANCE {
26-
// error strings should not be capitalized (ST1005)
27-
//nolint:stylecheck
26+
//lint:ignore ST1005 Given string is capitalized
27+
//nolint:staticcheck
2828
return 0, errors.New(tooChaoticError)
2929
}
3030

31-
var fragment []int32 = q[min(max(value-NEW_YEAR_CHAOS_TOLERANCE, 0), int32(i)):i]
31+
var fragment = q[min(max(value-NEW_YEAR_CHAOS_TOLERANCE, 0), int32(i)):i]
3232

3333
for _, k := range fragment {
3434
if k > value {

exercises/projecteuler/helpers/product.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
package helpers
22

33
func Product(numList []int) int {
4-
var result int = 1
4+
var result = 1
55

66
if len(numList) == 0 {
77
return 0

exercises/projecteuler/problem0008.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ const __BIT_SIZE__ = 32
1717

1818
func Problem0008(numberInput string) int {
1919

20-
var max int = 0
20+
var greatest = 0
2121

2222
var digitsSlice []int32
2323
var bigNumSlice = strings.Split(numberInput, "")
@@ -41,12 +41,12 @@ func Problem0008(numberInput string) int {
4141
var currentProduct = helpers.Product(digitsSet)
4242
utils.Debug("Product beetwen %d and %d <%d> is: %d", i, i+interval, digitsSet, currentProduct)
4343

44-
if currentProduct > max {
45-
max = currentProduct
44+
if currentProduct > greatest {
45+
greatest = currentProduct
4646
}
4747
}
4848

49-
utils.Info("Problem0008 => The the greatest product of %d consecutive digits is: %d", interval, max)
49+
utils.Info("Problem0008 => The the greatest product of %d consecutive digits is: %d", interval, greatest)
5050

51-
return max
51+
return greatest
5252
}

exercises/projecteuler/problem0010.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ func Problem0010(bottom int, top int) int {
1313

1414
var answer int
1515

16-
var primes []int = []int{2}
16+
var primes = []int{2}
1717

1818
var i = bottom
1919

exercises/projecteuler/problem0011.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func Problem0011(matrix [][]int, interval int) (int, bool) {
1414
return 0, true
1515
}
1616

17-
var max int = 0
17+
var greatest = 0
1818

1919
var quadrantSize = interval
2020
var matrixLimit = len(matrix) - (interval - 1)
@@ -33,8 +33,8 @@ func Problem0011(matrix [][]int, interval int) (int, bool) {
3333
diag1Acum *= matrix[i+k][j+k]
3434
diag2Acum *= matrix[i+k][j+(quadrantSize-1)-k]
3535

36-
max = helpers.IntMax(diag1Acum, max)
37-
max = helpers.IntMax(diag2Acum, max)
36+
greatest = helpers.IntMax(diag1Acum, greatest)
37+
greatest = helpers.IntMax(diag2Acum, greatest)
3838

3939
// reset lines
4040
var verticalAcum = 1
@@ -46,14 +46,14 @@ func Problem0011(matrix [][]int, interval int) (int, bool) {
4646
verticalAcum *= matrix[i+k][j+l]
4747
horizontalAcum *= matrix[i+l][j+k]
4848

49-
max = helpers.IntMax(verticalAcum, max)
50-
max = helpers.IntMax(horizontalAcum, max)
49+
greatest = helpers.IntMax(verticalAcum, greatest)
50+
greatest = helpers.IntMax(horizontalAcum, greatest)
5151
}
5252
}
5353
}
5454
}
5555

56-
utils.Info("Problem0011 max => %d", max)
56+
utils.Info("Problem0011 greatest => %d", greatest)
5757

58-
return max, false
58+
return greatest, false
5959
}

exercises/projecteuler/problem0014.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ func Problem0014(bottom int, top int) int {
1515

1616
for i := bottom; i < top; i += 1 {
1717

18-
var sequence []int = helpers.CollatzSequence(i)
18+
var sequence = helpers.CollatzSequence(i)
1919
utils.Debug("sequence of %d: %v", i, sequence)
2020

2121
if len(sequence) > len(maxSequence) {

0 commit comments

Comments
 (0)