Skip to content

Commit

Permalink
Rename variable to better reflect intention
Browse files Browse the repository at this point in the history
  • Loading branch information
mrekucci committed Nov 4, 2015
1 parent ea769bd commit 9986fc5
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions bsearch/firstk.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ func FirstK(an []int, k int) int {
l, r := 0, len(an)-1
for l <= r {
m := l + (r-l)/2 // Not (r+l)/2 'cause we want to avoid overflow.
switch e := an[m]; {
case e > k:
switch v := an[m]; {
case v > k:
r = m - 1
case e == k:
case v == k:
f, r = m, m-1
case e < k:
case v < k:
l = m + 1
}
}
Expand Down
8 changes: 4 additions & 4 deletions search/matrix.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,12 @@ package search
func Matrix(m [][]int, x int) bool {
r, c := 0, len(m)-1
for r < len(m) && c >= 0 {
switch e := m[r][c]; {
case e == x:
switch v := m[r][c]; {
case v == x:
return true
case e > x:
case v > x:
c--
case e < x:
case v < x:
r++
}
}
Expand Down

0 comments on commit 9986fc5

Please sign in to comment.