0461-0470

461. Hamming Distance \star

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
class Solution {
 public:
  int hammingDistance(int x, int y) {
    int ans = 0;

    while (x || y) {
      ans += (x % 2) ^ (y % 2);
      x /= 2;
      y /= 2;
    }

    return ans;
  }
};

462. Minimum Moves to Equal Array Elements II \star\star

463. Island Perimeter \star

464. Can I Win \star\star

465. Optimal Account Balancing \star\star\star

466. Count The Repetitions \star\star\star

467. Unique Substrings in Wraparound String \star\star

468. Validate IP Address \star\star

469. Convex Polygon \star\star

470. Implement Rand10() Using Rand7() \star\star