题解 | #DNA序列#
DNA序列
https://www.nowcoder.com/practice/e8480ed7501640709354db1cc4ffd42a
const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;
void async function () {
while(line = await readline()){
let num = parseInt(await readline())
let str = ''
let max = 0
for(let i=0; i<line.length-num+1; i++){
let temp = line.substring(i,i+num)
let length = 0
temp.replace(/[CG]/g,(match)=>{
length++
if(length>max){
max = length
str = temp
}
})
}
console.log(str);
}
}()

字节跳动工作强度 1114人发布