From c184fa6695f033d5c1237312a39b100432bc80a7 Mon Sep 17 00:00:00 2001 From: risenforward <37665595+risenforward@users.noreply.github.com> Date: Thu, 18 Jun 2020 19:15:46 +0300 Subject: [PATCH] Create genomic-range-query --- js/genomic-range-query | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 js/genomic-range-query diff --git a/js/genomic-range-query b/js/genomic-range-query new file mode 100644 index 0000000..cc3ddef --- /dev/null +++ b/js/genomic-range-query @@ -0,0 +1,36 @@ +// you can write to stdout for debugging purposes, e.g. +// console.log('this is a debug message'); + +function solution(S, P, Q) { + let n = S.length + let m = P.length + let A = [0], C = [0], G = [0] + let tempA = 0, tempC = 0, tempG = 0 + + for (let i=0; i 0) { + res[k] = 1 + } else if (C[Q[k] + 1] - C[P[k]] > 0) { + res[k] = 2 + } else if (G[Q[k] + 1] - G[P[k]] > 0) { + res[k] = 3 + } else { + res[k] = 4 + } + } + return res +}