{"id":"84ef470b-b8ec-4abb-a0c4-68f82d8751ab","name":"Words - K Selection - 2","description":"1. You are given a word (may have one character repeat more than once).\r\n2. You are given an integer k.\r\n2. You are required to generate and print all ways you can select k distinct characters out of the \r\n word.\r\n \r\nNote -> Use the code snippet and follow the algorithm discussed in question video. The judge can't \r\n force you but the intention is to teach a concept. Play in spirit of the question.\r\n\r\n ","inputFormat":"Input is managed for you","outputFormat":"Check the sample ouput and question video. ","constraints":"0 < str.length() < 15\r\n0 < k <= str.length()","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args){\r\n\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"aabbbccdde\r\n3","sampleOutput":"abc\r\nabd\r\nabe\r\nacd\r\nace\r\nade\r\nbcd\r\nbce\r\nbde\r\ncde","questionVideo":"https://www.youtube.com/embed/fy5mFaHVuRs?end=207","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"082986ae-d618-4a59-9ab3-6d79056679a4","name":"Recursion and Backtracking For Intermediate","slug":"recursion-and-backtracking-for-intermediate-330","type":0},{"id":"133fc7d5-fa3a-4884-98d7-05225a1e5906","name":"Words - K Selection - 2","slug":"words-k-selection-2","type":1}],"next":{"id":"ab776e0b-3f43-47c8-8779-35401e13e35f","name":"Words-k-selection-2 MCQ","type":0,"slug":"words-k-selection-2-mcq"},"prev":{"id":"7aef3448-e6d0-4327-a365-09f0891c71e7","name":"words-k-selection-1 MCQ","type":0,"slug":"words-k-selection-1-mcq"}}}

Words - K Selection - 2

1. You are given a word (may have one character repeat more than once). 2. You are given an integer k. 2. You are required to generate and print all ways you can select k distinct characters out 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.

{"id":"84ef470b-b8ec-4abb-a0c4-68f82d8751ab","name":"Words - K Selection - 2","description":"1. You are given a word (may have one character repeat more than once).\r\n2. You are given an integer k.\r\n2. You are required to generate and print all ways you can select k distinct characters out of the \r\n word.\r\n \r\nNote -> Use the code snippet and follow the algorithm discussed in question video. The judge can't \r\n force you but the intention is to teach a concept. Play in spirit of the question.\r\n\r\n ","inputFormat":"Input is managed for you","outputFormat":"Check the sample ouput and question video. ","constraints":"0 < str.length() < 15\r\n0 < k <= str.length()","sampleCode":{"cpp":{"code":""},"java":{"code":"import java.io.*;\r\nimport java.util.*;\r\n\r\npublic class Main {\r\n\r\n public static void main(String[] args){\r\n\r\n }\r\n\r\n}"},"python":{"code":""}},"points":10,"difficulty":"easy","sampleInput":"aabbbccdde\r\n3","sampleOutput":"abc\r\nabd\r\nabe\r\nacd\r\nace\r\nade\r\nbcd\r\nbce\r\nbde\r\ncde","questionVideo":"https://www.youtube.com/embed/fy5mFaHVuRs?end=207","hints":[],"associated":[],"solutionSeen":false,"tags":[],"meta":{"path":[{"id":0,"name":"home"},{"id":"0c54b191-7b99-4f2c-acb3-e7f2ec748b2a","name":"Data Structures and Algorithms","slug":"data-structures-and-algorithms","type":0},{"id":"082986ae-d618-4a59-9ab3-6d79056679a4","name":"Recursion and Backtracking For Intermediate","slug":"recursion-and-backtracking-for-intermediate-330","type":0},{"id":"133fc7d5-fa3a-4884-98d7-05225a1e5906","name":"Words - K Selection - 2","slug":"words-k-selection-2","type":1}],"next":{"id":"ab776e0b-3f43-47c8-8779-35401e13e35f","name":"Words-k-selection-2 MCQ","type":0,"slug":"words-k-selection-2-mcq"},"prev":{"id":"7aef3448-e6d0-4327-a365-09f0891c71e7","name":"words-k-selection-1 MCQ","type":0,"slug":"words-k-selection-1-mcq"}}}
plane

Editor


Loading...

Words - K Selection - 2

easy

1. You are given a word (may have one character repeat more than once). 2. You are given an integer k. 2. You are required to generate and print all ways you can select k distinct characters out 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.

Constraints

0 < str.length() < 15 0 < k <= str.length()

Format

Input

Input is managed for you

Output

Check the sample ouput and question video.

Example

Sample Input

aabbbccdde 3

Sample Output

abc abd abe acd ace ade bcd bce bde cde

Question Video

Discussions

Show Discussion

Related Resources

related resources

Turning Off Zen Mode