Given two sequences A, B, count number of unique ways in sequence A, to form a subsequence that is identical to the sequence B. - Codeprg

Breaking

programing News Travel Computer Engineering Science Blogging Earning

Saturday 9 May 2020

Given two sequences A, B, count number of unique ways in sequence A, to form a subsequence that is identical to the sequence B.

Given two sequences AB, count number of unique ways in sequence A, to form a subsequence that is identical to the sequence B.
Input 1:
    A = "abc"
    B = "abc"
    
Output 1:
1 Explanation 1: Both the strings are equal. Input 2: A = "rabbbit" B = "rabbit" Output 2: 3 Explanation 2: These are the possible removals of characters: => A = "ra_bbit" => A = "rab_bit" => A = "rabb_it"  
    Note: "_" marks the removed character.