Data Structures & AlgorithmsHardGATE CS · ICPC regional
How many distinct strings of length 3 are palindromes that occur as subsequences of abcab (of the form x y x with y different from x)?
- A. 5
- B. 6
- C. 4
- D. 8
Correct answer: C. 4
The strings are aba, aca, bab and bcb, each formed by two equal outer letters at positions that bracket a different middle letter; the count is 4.
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
- What is the length of the longest palindromic subsequence of the string leetcode?
- How many contiguous non-empty substrings of aaabbbaa consist of a single repeated letter?
- What is the sum of the distinct prime divisors of 2310?
- How many positive divisors does 2^5 3^3 5^2 have?
- How many integers x in [1, 200] are divisible by 4 but not by 6?
- What is the sum of (x^2 mod 13) for x = 1 to 12, taken modulo 13?