Code
Hub
Workspaces
Following
Trending
Connect
MCP
copy
Create free account
hub
/
github.com/careercup/ctci
/ getMaxNaive
Method
getMaxNaive
java/Chapter 17/Question17_4/Question.java:14–18 ·
view source on GitHub ↗
(int a, int b)
Source
from the content-addressed store, hash-verified
12
}
13
14
public
static
int
getMaxNaive(
int
a,
int
b) {
15
int
k = sign(a - b);
16
int
q = flip(k);
17
return
a * k + b * q;
18
}
19
20
public
static
int
getMax(
int
a,
int
b) {
21
int
c = a - b;
Callers
1
main
Method · 0.95
Calls
2
sign
Method · 0.95
flip
Method · 0.95
Tested by
no test coverage detected