Skip to content

Commit

Permalink
删除无用代码
Browse files Browse the repository at this point in the history
  • Loading branch information
Azureki committed Apr 25, 2019
1 parent be910ce commit ec9355d
Showing 1 changed file with 1 addition and 25 deletions.
26 changes: 1 addition & 25 deletions 69. Sqrt(x)/main.go
Original file line number Diff line number Diff line change
@@ -1,22 +1,4 @@
package main

import "fmt"

func mySqrt2(x int) int {
x0 := 1
var tem int
for {
tem = x0
x0 = (x0 + x/x0) / 2
fmt.Println(x0)
if tem <= x0 {
break
}

}
return x0

}
package problem64

func mySqrt(x int) int {
if x == 0 {
Expand All @@ -28,15 +10,9 @@ func mySqrt(x int) int {
mid = (left + right) / 2
if mid*mid > x {
right = mid
fmt.Println("right:", right)
} else {
left = mid
fmt.Println("left:", left)
}
}
return left
}

func main() {
fmt.Println(mySqrt(4))
}

0 comments on commit ec9355d

Please sign in to comment.