seanlucius / string-permutations-dc-web-career-021819

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

String Permutations

Problem

Given a string made up of unique characters, create a function findAllPermutations() that finds and returns all permutations of that string as a single array.

For example:

findAllPermutations('abc')
//['abc', 'bca', 'cab', 'acb', 'bac', 'cba']

The order of the elements in the returned array does not matter. For example, findAllPermutations('abc') can return the array ['abc', 'bca', 'cab', 'acb', 'bac', 'cba'] or ['abc', 'acb', 'bca', 'bac', 'cab', 'cba'].

For this problem, you can assume the given string does not have duplicate characters.

Process

Mainly, this is your chance to shine. This problem is hard, but one of the nice things about it is that it has many different solutions.

Use it as a mechanism to focus on process, and work with a partner, if you can. Think about this problem as a practice in breaking down problems, and knowing when to retreat from a potential solution. Remember from the last lesson to try to derive what was good and what did not work in your previous attempt, before moving onto a new attempt.

A couple small hints to get started: where are some examples where the solution becomes obvious. What can you learn from it. Ok that's enough.

Be self-aware about when your process. When is your process good, and when it is less sucessful? We are trying to be disciplined about developing good habits as much as anything else.

About

License:Other


Languages

Language:JavaScript 65.3%Language:HTML 34.7%