Data Structures & AlgorithmsModerateTCS NQT Digital · Accenture
Problem: How many binary strings of length 6 contain neither the substring "00" nor "11"?
- A. 3
- B. 1
- C. 2
- D. 4
Correct answer: C. 2
Only alternating strings qualify, so each of the two starting digits forces the whole string. Counting strings with no run of length three treats a different constraint.
More Coding Interview Problems questions
- Problem: The number of partitions of 12 into parts of size at most 4 (order of parts does not matter) is what value?
- Problem: The longest palindromic subsequence of "character" has what length?
- Problem: Ropes of lengths 4, 3, 2 and 6 are joined pairwise; joining two ropes costs the sum of their lengths, and the next join uses the…
- Problem: How many integers n with 1 ≤ n ≤ 100 have a binary representation that reads the same forwards and backwards?
- Problem: What is the sum of the smallest prime factors of the integers 2 through 30 (each integer contributes its smallest prime divisor)?
- Problem: How many positive divisors does the number 2^10 × 3^4 have?