Merge pull request #60 from halfrost/code_quality_improvement

optimization code quality level from A to A+
This commit is contained in:
halfrost
2020-08-27 01:07:57 +08:00
committed by YDZ
543 changed files with 2463 additions and 2412 deletions

View File

@ -5,7 +5,7 @@ import (
)
func oddEvenJumps(A []int) int {
oddJumpMap, evenJumpMap, count, current, res := map[int]int{}, map[int]int{}, 1, 0, 0
oddJumpMap, evenJumpMap, current, res := map[int]int{}, map[int]int{}, 0, 0
for i := 0; i < len(A); i++ {
for j := i + 1; j < len(A); j++ {
if v, ok := oddJumpMap[i]; ok {
@ -42,7 +42,8 @@ func oddEvenJumps(A []int) int {
}
fmt.Printf("oddJumpMap = %v evenJumpMap = %v\n", oddJumpMap, evenJumpMap)
for i := 0; i < len(A); i++ {
count, current = 1, i
count := 1
current = i
for {
if count%2 == 1 {
if v, ok := oddJumpMap[current]; ok {