Skip to content

Commit 000b23f

Browse files
aQuaaQua
authored andcommitted
755 100% coverage
1 parent 664af18 commit 000b23f

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Algorithms/0755.reach-a-number/reach-a-number.go

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@ func reachNumber(target int) int {
99
target = -target
1010
}
1111

12-
if target == 0 || target == 1 {
13-
return target
14-
}
15-
1612
n := int(math.Ceil((math.Sqrt(8*float64(target)+1) - 1) / 2))
1713

1814
sum := n * (n + 1) / 2

Algorithms/0755.reach-a-number/reach-a-number_test.go

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,11 @@ var tcs = []struct {
1818
44721,
1919
},
2020

21+
{
22+
-1000,
23+
47,
24+
},
25+
2126
{
2227
1000,
2328
47,

0 commit comments

Comments
 (0)