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 Dynamic Programming but also build up problem-solving skills.
In this problem, we are given a string s of length n, find all the possible subsequences of the string s in lexicographically-sorted order.
Example :
Input :
s = "abc"
Output:
a ab abc ac b bc c
Explanation :
There are a total 7 number of subsequences possible for the given string, and they are mentioned above in lexicographically sorted order.
Give the problem a try before going through the video. All the best!!!
Problem Link: https://practice.geeksforgeeks.org/problems-preview/power-set4302/1
Solution IDE Link: https://ide.geeksforgeeks.org/online-cpp-compiler/a229cf44-1c2f-43a5-ac07-f0fb0f74eecc