Hackerrank – Maximizing XOR

Problem Statement A description of the problem can be found on Hackerrank. Solution Create all pairs for all numbers in interval [l, r]. XOR each pair and select maximum. I created solution in: Java JavaScript Scala Ruby All solutions are also available on my GitHub. Java

JavaScript

Scala

Ruby

Hackerrank – Flipping Bits

Problem Statement A description of the problem can be found on Hackerrank. Solution Define maximum unsigned int in binary as: 11 111 111 111 111 111 111 111 111 111 111. For all input number XOR with maximum and print the output. Aware that some programming languages have signed numbers. It is better to use […]