Redirecting to
NADOS
- Permutation - 1
- Permutations - 2
- Combinations - 1
- Combinations - 2
- Queens Permutations - 2d As 2d - Queen Chooses
- Queens Combinations - 2d As 2d - Box Chooses
- Queens Permutations - 2d As 2d - Box Chooses
- Queens Combinations - 2d As 2d - Queen Chooses
- Queens Combinations - 2d As 1d - Queen Chooses
- Nqueens Permutations - 2d As 1d - Queen Chooses
- Nqueens Combinations - 2d As 1d - Queen Chooses
- N Queens - Branch And Bound
- Nknights Combinations - 2d As 1d - Knight Chooses
- Permutations - Words - 1
- Permutations - Words - 2
- Words - K Selection - 1
- Words - K Selection - 2
- Words - K Selection - 3
- Words - K Selection - 4
- Words - K Length Words - 1
- Words - K Length Words - 2
- Words - K Length Words - 3
- Words - K Length Words - 4
- Coin Change - Combinations - 1
- Coin Change - Combinations - 2
- Coin Change - Permutations - 1
- Coin Change - Permutations - 2
- Solve Sudoku
- Crossword Puzzle
- Cryptarithmetic
- Gold Mine - 2
- Josephus Problem
- Lexicographical Numbers
- Friends Pairing - 2
- K-partitions
- K Subsets With Equal Sum
- Abbreviation Using Backtracking
- Max Score
- All Palindromic Permutations
- All Palindromic Partitions
- Pattern Matching
- Word Break - I
- Remove Invalid Parenthesis
- Tug Of War
- Largest Number Possible After At Most K Swaps
- Magnets
- Abbreviations using Backtracking
- Max Score
- N Queens Branch and Bound
- Josephus Problem
- Permutations - 1
- Lexicographical Numbers
- Gold Mine - 2
- Maximum Number After K Swaps
- K Length Words-3
- Permutations - 2
- Coin Change Combination-2
- Combinations - 1
- Friends Pairing - 2
- Remove Invalid Parentheses
- Sudoku Solver
- Word break-1
- Words - K Selection - 2
- Tug Of War
- K Subsets with Equal Sum
- Combinations - 2
- Nqueens Combinations - 2d As 1d - Queen Chooses
- Queens Combinations - 2d As 1d - Queen Chooses
- Cryptarithmetic
- Coin change combination-1
- Coin Change Permutations-2
- Coin Change Permutations-1
- K - Partitions
- All Palindromic Partitions
- Queens Combinations - 2d As 2d - Box Chooses
- Queens Permutations - 2d As 2d - Queen Chooses
- Queens Permutations - 2d As 2d - Box Chooses
- Queens Combinations - 2d As 2d - Queen Chooses
- Nknights Combinations - 2d As 1d - Knight Chooses
- Nqueens Permutations - 2d As 1d - Queen Chooses
- Permutations words-1
- Permutations Words-2
- Words - K Selection - 1
- Words-k length words-1
- Words-K Length Words-2
- Words - K Selection - 3
- Words - K Selection - 4
- Words-K Length Words-4
Words - K Length Words - 2
Try First, Check Solution later
1. You should first read the question and watch the question video.2. Think of a solution approach, then try and submit the question on editor tab.3. We strongly advise you to watch the solution video for prescribed approach.1. You are given a word (may have one character repeat more than once).Input Format
2. You are given an integer k.
3. You are required to generate and print all k length words (of distinct chars) by using chars of the
word.
Note -> Use the code snippet and follow the algorithm discussed in question video. The judge can't
force you but the intention is to teach a concept. Play in spirit of the question.
Input is managed for youOutput Format
Check the sample ouput and question video.Question Video Constraints
0 < str.length() < 15Sample Input
0 < k <= str.length()
aabbbccddeSample Output
3
abc
abd
abe
acb
acd
ace
adb
adc
ade
aeb
aec
aed
bac
bad
bae
bca
bcd
bce
bda
bdc
bde
bea
bec
bed
cab
cad
cae
cba
cbd
cbe
cda
cdb
cde
cea
ceb
ced
dab
dac
dae
dba
dbc
dbe
dca
dcb
dce
dea
deb
dec
eab
eac
ead
eba
ebc
ebd
eca
ecb
ecd
eda
edb
edc
-
Asked in Companies
-
Related Topics
Your profile is incomplete!
Please click here to complete your profile to continue submitting questions.
Video Solution
Code Solution
{ }
Editor Settings
Font Size
Key Binding
Keyboard Shortcut
- fold Alt-L|Ctrl-F1
- unfold Alt-Shift-L|Ctrl-Shift-F1
- Gotoend Ctrl-End
- Gotostart Ctrl-Home
- Movelinesup Alt-Up
- Movelinesdown Alt-Down
- Undo Ctrl-Z
- Redo Ctrl-Shift-Z|Ctrl-Y
- Replace Ctrl-H
- Togglecomment Ctrl-/
- ToggleBlockComment Ctrl-Shift-/
- Removeline Ctrl-D
{ }
Run
Editor Settings
Font Size
Key Binding
Keyboard Shortcut
- fold Alt-L|Ctrl-F1
- unfold Alt-Shift-L|Ctrl-Shift-F1
- Gotoend Ctrl-End
- Gotostart Ctrl-Home
- Movelinesup Alt-Up
- Movelinesdown Alt-Down
- Undo Ctrl-Z
- Redo Ctrl-Shift-Z|Ctrl-Y
- Replace Ctrl-H
- Togglecomment Ctrl-/
- ToggleBlockComment Ctrl-Shift-/
- Removeline Ctrl-D