From 01f1af4b0649a7148952ea420411ea339419d58f Mon Sep 17 00:00:00 2001 From: kkloberdanz Date: Sat, 25 Sep 2021 15:17:23 -0500 Subject: [PATCH] fixed mode count when all numbers are equal --- stc.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/stc.go b/stc.go index 93b36aa..a28ce61 100644 --- a/stc.go +++ b/stc.go @@ -116,6 +116,7 @@ func main() { sort.Slice(allNumbers, func(i, j int) bool { return allNumbers[i].num < allNumbers[j].num }) + mode = allNumbers[0].num allNumbersLen := len(allNumbers) if allNumbersLen%2 == 0 { a := allNumbers[(allNumbersLen/2)-1].num @@ -160,6 +161,9 @@ func main() { currentCount = 1 } } + if modeCount == 0 { + modeCount = currentCount + } } if *gPtr {