Login

Striver SDE Sheet Problems

Problem title

Difficulty

Avg time to solve

Longest Consecutive Sequence

Moderate

40 mins

Valid Parentheses

Easy

10 mins

N Queens

Hard

55 mins

Rat In a Maze All Paths

Moderate

40 mins

Return Subsets Sum to K

Moderate

40 mins

Sudoku?

Moderate

40 mins

LRU Cache Implementation

Moderate

25 mins

Print Permutations - String

Easy

30 mins

Implement Stack With Linked List

Moderate

30 mins

Ways To Make Coin Change

Moderate

20 mins

Problem

Submissions

32

Avg. time to solve

30 min

Success Rate

80%

Problem Statement

```
1. The input string may contain the same characters, so there will also be the same permutations.
2. The order of permutation does not matter.
```

```
The first and only line of input contains a string 'S' of alphabets in lower case characters.
```

```
Print all the permutations of the given string 'S' in a separate line.
```

```
You do not need to print anything, it has already been taken care of. Just implement the given function.
```

```
0 <= |S| <= 8
Where |S| denotes the length of string 'S'.
Time limit: 1 sec
```

```
cba
```

```
abc
acb
bac
bca
cab
cba
```

```
All the possible permutations for string "cba" will be "abc", "acb", "bac", "bca", "cab" and "cba".
```

```
xyx
```

```
xyx
xxy
yxx
yxx
xyx
xxy
```

```
All the possible permutations for string "xyx" will be "xyx", "xxy", "yxx", "yxx", "xyx" and "xxy". Here, all three permutations "xyx", "yxx", "xxy" are repeating twice but we need to print all the possible permutations and hence we are printing them twice..
```

Console

Sample Test Case

Custom Test Case

Download Test Cases

Test Case 1

Test Case 2

Test Case 3

Saving Code...

Full Screen Mode

Change Language

Change Theme

Solution submission not allowed

Save Code

Reset Code