create javascript/shuffle instructions
parent
5aef1b4600
commit
26c7a5b9bc
|
@ -0,0 +1,14 @@
|
|||
*How to shuffle the characters in a string in JavaScript ?*
|
||||
|
||||
e.g. Given "ABCDEFG", return something like "GEFBDCA".
|
||||
|
||||
```js
|
||||
console.log(shuffle("the quick brown fox jumps over the lazy dog"));
|
||||
//-> "veolrm hth ke opynug tusbxq ocrad ofeizwj"
|
||||
|
||||
console.log(shuffle("the quick brown fox jumps over the lazy dog"));
|
||||
//-> "o dt hutpe u iqrxj yaenbwoolhsvmkcger ozf "
|
||||
```
|
||||
|
||||
- Best performance case: O(n)
|
||||
- Worst performance case: O(n log n)
|
Loading…
Reference in New Issue