Data Structures & AlgorithmsHardCodeforces Div2 C · GATE CS
What is the length of the longest palindromic substring of "forgeeksskeegfor"?
- A. 8
- B. 1
- C. 16
- D. 10
Correct answer: D. 10
Expanding around each centre finds the even-length palindrome 'geeksskeeg' centred between the two s letters: length 10. Trying only odd centres finds no palindrome longer than 1, stopping one step early gives 8, and 16 is the whole string.
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
- Which string is the lexicographically smallest rotation of "bcabca"?
- With coin denominations 1, 3 and 4, what is the minimum number of coins needed to make the amount 6?
- What is the maximum number of pairwise non-overlapping intervals (an interval [s, f) may touch the next one at f = s) chosen from…
- A railway station receives trains at times 900, 940, 950, 1100, 1500, 1800 and each train leaves at 910, 1200, 1120, 1130, 1900, 2000…
- For the array [3, 1, 4, 1, 5, 9, 2, 6], how many subarrays have a product that is a multiple of 6?
- Let A = [5, 3, 6, 2, 7, 1] (0-based), with P[0] = 0 and P[i] = A[0] ⊕ … ⊕ A[i−1]. What is A[2] ⊕ A[3] ⊕ A[4]?