Data Structures & AlgorithmsHardProduct Company SDE · ICPC regional
Problem: What is the minimum number of characters that must be inserted anywhere in "leetcode" to make it a palindrome?
- A. 5
- B. 6
- C. 4
- D. 7
Correct answer: A. 5
Insertions needed equal length minus the longest palindromic subsequence, the same quantity as minimum deletions. Counting the length of the longest palindromic substring instead is wrong.
More Coding Interview Problems questions
- Problem: What is the length of the longest valid (well-formed) parentheses substring of ")()())(()" ?
- Problem: How many strings of length 8 made of matched parentheses ( and ) are valid (well-formed)?
- Problem: A robot is on a 4×4 torus (moving off one edge reappears on the opposite edge) starting at (0,0), using row, column coordinates…
- Problem: Evaluate the postfix expression "3 4 + 2 7 −" using a stack (the operator pops the top two values, computes second-from-top op…
- Problem: Rule 30 cellular automaton on an infinite line starts with a single live cell. Each generation, a cell's new state is determined…
- Problem: How many integers x with 1 ≤ x ≤ 100 have an odd number of set bits in their binary representation AND are odd themselves?