Remove live code & console.log, leave examples as comments (ProjectEuler, Recursive).

This commit is contained in:
Eric Lavault
2021-10-10 18:18:25 +02:00
parent 9212e6d684
commit 5f45b540b9
17 changed files with 48 additions and 98 deletions

View File

@ -19,14 +19,12 @@
* https://en.wikipedia.org/wiki/Lexicographic_order
*/
const subsequence = (str, seq, low) => {
export const subsequence = (str, seq, low, output = []) => {
if (low <= str.length && str.length !== 0) {
console.log(seq)
output.push(seq)
}
for (let i = low; i < str.length; i++) {
subsequence(str, seq + str[i], i + 1)
subsequence(str, seq + str[i], i + 1, output)
}
return output
}
const str = 'abcd'
subsequence(str, '', 0)