e296a1bcc3 | ||
---|---|---|
.. | ||
readme.md | ||
shuffle.go | ||
shuffle_test.go |
readme.md
How to shuffle the characters in a string in JavaScript ?
e.g. Given "ABCDEFG", return something like "GEFBDCA".
print(shuffle("the quick brown fox jumps over the lazy dog"));
//-> "veolrm hth ke opynug tusbxq ocrad ofeizwj"
print(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)