add new solutions
This commit is contained in:
parent
ca24d0a56a
commit
0c73608ce5
36 changed files with 791 additions and 0 deletions
16
solutions/20/q2011/solution.go
Normal file
16
solutions/20/q2011/solution.go
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
package q2011
|
||||
|
||||
func finalValueAfterOperations(operations []string) int {
|
||||
x := 0
|
||||
for i := range operations {
|
||||
switch operations[i] {
|
||||
case "X++", "++X":
|
||||
x++
|
||||
case "X--", "--X":
|
||||
x--
|
||||
}
|
||||
}
|
||||
return x
|
||||
}
|
||||
|
||||
var _ = finalValueAfterOperations
|
||||
Loading…
Add table
Add a link
Reference in a new issue