• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
February 23, 2024 |780 Views
PROBLEM OF THE DAY : 22/02/2024 | Distinct occurrences
Description
Discussion

Welcome to the daily solving of our PROBLEM OF THE DAY with Yash Dwivedi. We will discuss the entire problem step-by-step and work towards developing an optimized solution. This will not only help you brush up on your concepts of Strings but also build up problem-solving skills.

In this problem, we are given two strings s and t of length n and m respectively. Find the count of distinct occurrences of t in s as a sub-sequence modulo 109 + 7.

Example :

Input:
s = "banana" , t = "ban"
Output: 
3
Explanation: 
There are 3 sub-sequences:[ban], [ba n], [b an].
 

Give the problem a try before going through the video. All the best!!!
Problem Link: https://www.geeksforgeeks.org/problems/distinct-occurrences/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp14-compiler/9e9c7fbb-7553-44ed-b05d-a9bd2afbb6cf

Read More