# Leetcode - Hamming Distance

https://leetcode.com/problems/hamming-distance/

The Hamming distance between two integers is the number of positions at which the corresponding bits are different.

Given two integers `x`

and `y`

, calculate the Hamming distance.

**Note:**

0 ≤ `x`

, `y`

< 2^{31}.

**Example:**

Input:x = 1, y = 4Output:2Explanation:1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ The above arrows point to positions where the corresponding bits are different.

func hammingDistance(x int, y int) int { xor := x^y count := 0 for xor != 0 { if xor % 2 == 1 { count++ } xor = xor >> 1 } return count }

Feb 09, 2023 01:42:34 PM

We will explain how to gain access to Amazon Prime login and become legitimate in order to use the features, and there is a direct approach to obtain the amount prime, which is to debit your money on a monthly basis. amazon prime video login This will be determined by how much of your account's facilities you have utilized, and you will be charged accordingly. You can also get Amazon Prime for free if you use any of the discounts on Airtel, Jio, and other items.

Jul 16, 2023 09:33:59 PM

The SCERT Uttarakhand 4th Class Syllabus 2024 All Subject Chapter Wise Students Prepare for the Upcoming 4th Exam, it is quite Essential that they have the Complete Knowledge of the Uttarakhand 4th Class Latest Syllabus 2024 of All Relevant Subjects, Knowing the Details of Prescribed Topics and the weight age Allotted to Them Makes it easy to plan your Studies Meticulously so that SCERT Uttarakhand 4th Class Syllabus 2024 you can make Effective Preparations for your Exam and obtain desired marks.All the Students who are Going to Appear for the Examination can make use of the Information Provided here.