From 186972ba65e8cf99aefd2a5b8232649a3a0bcbfe Mon Sep 17 00:00:00 2001 From: risenforward <37665595+risenforward@users.noreply.github.com> Date: Tue, 23 Jun 2020 09:59:23 +0300 Subject: [PATCH] Create fish --- js/fish | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 js/fish 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 +}