We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent eec23bb commit 1424515Copy full SHA for 1424515
src/main/java/com/thealgorithms/bitmanipulation/HammingDistance.java
@@ -1,6 +1,18 @@
1
package com.thealgorithms.bitmanipulation;
2
3
-public class HammingDistance {
+/**
4
+ * The Hamming distance between two integers is the number of positions at which the corresponding bits are different.
5
+ * Given two integers x and y, calculate the Hamming distance.
6
+ * Example:
7
+ * Input: x = 1, y = 4
8
+ * Output: 2
9
+ * Explanation: 1 (0001) and 4 (0100) have 2 differing bits.
10
+ *
11
+ * @author Hardvan
12
+ */
13
+public final class HammingDistance {
14
+ private HammingDistance() {
15
+ }
16
17
/**
18
* Calculates the Hamming distance between two integers.
0 commit comments