• Courses
  • Tutorials
  • Jobs
  • Practice
  • Contests
September 21, 2023 |220 Views
SDE Sheet - Convert a Sentence into its equivalent mobile numeric keypad sequence.
  Share  2 Likes
Description
Discussion

This video is part of Strings section under GFG SDE Sheet.

In this video, we are given two strings S and P. Find the smallest window in the string S consisting of all the characters(including duplicates) of the string P.  Return "-1" in case there is no such window present. In case there are multiple such windows of same length, return the one with the least starting index.
Note : All characters are in Lowercase alphabets.

Example :

Input:
S = "timetopractice"
P = "toc"
Output: 
toprac
Explanation: "toprac" is the smallest substring in which "toc" can be found.

Try it out before watching the implementation of the problem in the video. We recommend watching the video, even if you can solve the problem. You may discover something new. All the best!!!

Do check out:-

Article: https://www.geeksforgeeks.org/convert-sentence-equivalent-mobile-numeric-keypad-sequence/
Problem: https://practice.geeksforgeeks.org/problems/convert-a-sentence-into-its-equivalent-mobile-numeric-keypad-sequence0547/1
SDE Sheet: https://www.geeksforgeeks.org/sde-sheet-a-complete-guide-for-sde-preparation/

Read More