Data Structures & AlgorithmsVery hardCodeforces Div2 B-D · ICPC regional
What is the minimum number of characters that must be inserted anywhere in "abcb" to make it a palindrome?
- A. 1
- B. 2
- C. 3
- D. 0
Correct answer: A. 1
Insertions needed equal n minus the longest palindromic subsequence (here 'bcb' has length 3). Interval DP computes the same count.
Practise more Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questionsArrays, Strings, Linked Lists, Stacks, Queues and Hashing: notes and key points
More Arrays, Strings, Linked Lists, Stacks, Queues and Hashing questions
- How many windows of size 4 in [1, 2, 1, 3, 4, 2, 5, 6] contain four pairwise distinct values?
- What is the smallest positive integer n such that n! ends in exactly 10 trailing zeros?
- Items [1, 1, 1, 1, 2, 2, 3] must be placed into stacks of capacity 3 such that each stack holds only identical items. What is the minimum…
- How many index pairs i < j in [0, 1, 2, 3, 4] satisfy a[i] + a[j] = a[i] a[j]?
- Repeatedly remove adjacent equal characters from "abbaca" using a stack. How many characters are removed in total?
- How many integers n from 1 to 99 inclusive have both n and n + 1 squarefree (not divisible by any square greater than 1)?