Skip to content

Commit

Permalink
Merge 01aa8be into 7b6b082
Browse files Browse the repository at this point in the history
  • Loading branch information
vaskoz committed Aug 27, 2019
2 parents 7b6b082 + 01aa8be commit 39e0565
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion day271/problem.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,13 @@ import "sort"
func BinarySearch(sorted []int, x int) int {
left, right := 0, len(sorted)-1
for left < right {
mid := (left + right) / 2
var mid int
dividend := left + right
divisor := 2
for dividend >= divisor {
dividend -= divisor
mid++
}
val := sorted[mid]
switch {
case x == val:
Expand Down

0 comments on commit 39e0565

Please sign in to comment.