Data Structures & AlgorithmsHardTCS NQT Digital · Product Company SDE
Problem: Starting from 3, you may apply two operations: "+1" or "×2". What is the minimum number of operations needed to reach exactly 50?
- A. 5
- B. 6
- C. 4
- D. 7
Correct answer: A. 5
BFS over the value graph finds the fewest operations, bounding values to avoid runaway growth. Greedy halving from 50 back to 3 can take a different number of steps when the parity misleads.
More Coding Interview Problems questions
- Problem: A knight starts at square (0,0) on an infinite chessboard. What is the minimum number of knight moves needed to reach square (4,5)?
- Problem: The complete graph K6 has 15 edges. A perfect matching of 3 disjoint edges is removed. How many edges remain?
- Problem: What is the chromatic number of the cycle graph C5 (5 vertices in a single cycle)? The chromatic number is the least number of…
- Problem: What is the independence number of the cycle graph C7 (the maximum number of vertices with no two adjacent in the 7-cycle)?
- Problem: The binary search tree is built by inserting 8, 3, 10, 1, 6, 14, 4, 7, 13 in this order. How many nodes lie at the maximum depth…
- Problem: A binary tree is given in level order with None for missing children: [1, 2, 3, None, 4, 5, None, 6]. In this array, node at…