We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Good morning! Here's your coding interview problem for today.
This problem was asked by Nvidia.
Find the maximum of two numbers without using any if-else statements, branching, or direct comparisons.
The text was updated successfully, but these errors were encountered:
A bit-fiddling question.
Sorry, something went wrong.
I used this article to understand the math behind the bit manipulation: https://www.geeksforgeeks.org/compute-the-minimum-or-maximum-max-of-two-integers-without-branching/
NOTE: The XOR version can't be done without branching in Go since Go doesn't provide integer values for Boolean values.
goos: darwin goarch: amd64 BenchmarkMaxIf-4 2000000 906 ns/op BenchmarkMaxSubtractAndShift-4 3000000 494 ns/op BenchmarkMaxXor-4 2000000 1027 ns/op
vaskoz
Successfully merging a pull request may close this issue.
Good morning! Here's your coding interview problem for today.
This problem was asked by Nvidia.
Find the maximum of two numbers without using any if-else statements, branching, or direct comparisons.
The text was updated successfully, but these errors were encountered: