File tree Expand file tree Collapse file tree
exercises/hackerrank/interview_preparation_kit/arrays Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -11,6 +11,7 @@ import (
1111
1212//nolint:stylecheck // error strings should not be capitalized (ST1005)
1313const tooChaoticError = "Too chaotic"
14+ const NEW_YEAR_CHAOS_TOLERANCE = 2
1415
1516func minimumBribesCalculate (q []int32 ) (int32 , error ) {
1617
@@ -21,12 +22,13 @@ func minimumBribesCalculate(q []int32) (int32, error) {
2122 for _ , value = range q {
2223 position := i + 1
2324
24- if value - int32 (position ) > 2 {
25- //nolint:stylecheck // error strings should not be capitalized (ST1005)
25+ if value - int32 (position ) > NEW_YEAR_CHAOS_TOLERANCE {
26+ // error strings should not be capitalized (ST1005)
27+ //nolint:stylecheck
2628 return 0 , errors .New (tooChaoticError )
2729 }
2830
29- var fragment []int32 = q [min (max (value - 2 , 0 ), int32 (i )):i ]
31+ var fragment []int32 = q [min (max (value - NEW_YEAR_CHAOS_TOLERANCE , 0 ), int32 (i )):i ]
3032
3133 for _ , k := range fragment {
3234 if k > value {
You can’t perform that action at this time.
0 commit comments