ianadiwibowo/central-park

View on GitHub
hackerrank/string_manipulation/alternating_characters/main.go

Summary

Maintainability
A
0 mins
Test Coverage
package main

func AlternatingCharacters(s string) int32 {
    var removalCount int32
    var prevChar rune
    for _, r := range s {
        if r == prevChar {
            removalCount++
        }
        prevChar = r
    }

    return removalCount
}

func main() {

}