Skip to content

Instantly share code, notes, and snippets.

View abeltolu's full-sized avatar
🏠
Working from home

Adetula Tolulope Abel abeltolu

🏠
Working from home
View GitHub Profile
@abeltolu
abeltolu / gist:d48eae2c5bfb268e6744236e555b1fa6
Created November 24, 2019 15:14
Get the longest subsequence between two strings
function getSubsequences(str){
let len = str.length, output, counter = 0, result = [];
for (let i = 1; i < Math.pow(2, len); i++) {
output = '';
for (var j = 0; j < len; j++) {
if (i & (1 << j)) {
output += str[j];
}
}
counter++;