Company: Publicis Sapient_8oct
Difficulty: medium
Palindromic Subsequences of Length 5 Problem Description For a string s consisting only of characters '0' and '1', determine the number of subsequences of length 5 that are palindromes. Since the result can be very large, return the answer modulo (10 9 + 7). Notes: A palindrome is a sequence that reads the same backward as forward. A subsequence is obtained from the given sequence by deleting zero or more elements without changing the order of the remaining elements. Two subsequences are considered different if the indices used to form them are different. For example, given s = "0100110" and using 1-based indexing, some subsequences of length 5 are: indices (1, 2, 3, 6, 7) -> 01010 indices (1, 2, 3, 5, 7) -> 01010 indices (1, 2, 4, 6, 7) -> 01010 indices (1, 2, 4, 5, 7) -> 01010 indices (1, 2, 5, 6, 7) -> 01110 The value 5 modulo (10 9 + 7) = 5 refers to the count of these specific subsequences, not necessarily palindromic ones. The problem asks for the count of palindromic subsequence