Data Structures & AlgorithmsModerateTCS NQT · bit operations
Problem: What is the Hamming distance between 1011 and 1101 in binary?
- A. 1
- B. 2
- C. 3
- D. 4
Correct answer: B. 2
The strings differ in the second and third positions: 1011 vs 1101 gives differences at positions 2 and 3.
More Coding Interview Problems questions
- Problem: Which property must a graph have for Euler's theorem to guarantee an Euler circuit?
- Problem: What is the complexity of computing the number of distinct paths in a DAG with V vertices and E edges by DP?
- Problem: How many 4-digit numbers (from 1000 to 9999) are palindromes? Run the code. python print(sum(1 for x in range(1000, 10000) if…
- Problem: What is the time complexity of building a suffix tree of a string of length n over a fixed alphabet with Ukkonen's online…
- Problem: A 3×4 grid has walls '#' at (0,2), (1,1), (2,3). Moves go up, down, left and right through open cells. Starting from (0,0), how…
- Problem: A directed graph has arcs 0→1 (0), 1→2 (3), 0→2 (5), 2→3 (0), 1→3 (7), 3→4 (2), 2→4 (4), 4→5 (1), 0→5 (9). Arc weights may be…