diff --git a/js/fish b/js/fish new file mode 100644 index 0000000..665b776 --- /dev/null +++ b/js/fish @@ -0,0 +1,21 @@ +function solution(A, B) { + let stack_1 = [], count = 0 + for (i=0; i=0) { + if (stack_1[j] > A[i]) { + break; + } else { + stack_1.pop() + } + j-- + } + if (j<0) count++ + } else { + stack_1.push(A[i]) + } + } + + return count + stack_1.length +}