FazeelUsmani / Amazon-SDE-Preparation

This repository includes all the interview preparation questions for Amazon SDE role
https://practice.geeksforgeeks.org/batch/Amazon-Test-Series
1.12k stars 291 forks source link

06 String --> 02 Print all possible strings #45

Closed FazeelUsmani closed 3 years ago

FazeelUsmani commented 3 years ago
  1. Print all possible strings Basic Accuracy: 29.93% Submissions: 5989 Points: 1 Given a string str your task is to complete the function spaceString which takes only one argument the string str and finds all possible strings that can be made by placing spaces (zero or one) in between them.

For eg . for the string abc all valid strings will be abc ab c a bc a b c

Example 1:

Input: str = abc Output: abc$ab c$a bc$a b c$ Example 2:

Input: str = xy Output: xy$x y$

Your Task: Complete the function spaceString() which takes a character array as an input parameter and returns list of all possible answers. The driver code will print the all possible answer '$' separated

Expected Time Complexity: O(N * 2N) Expected Auxiliary Space: O(N)

Constraints: 1<= length of string str <=10

Note:The Input/Ouput format and Example given are used for system's internal purpose, and should be used by a user for Expected Output only. As it is a function problem, hence a user should not read any input from stdin/console. The task is to complete the function specified, and not to write the full code.

Juro221 commented 3 years ago

Hey, i was the one writing u email. Can u please assign me this issue?

FazeelUsmani commented 3 years ago

Sure, @Juro221.