We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
第一次在面试中碰到出笔试题形式的算法题。上来就是一大段文字,什么小Q小强怎么的,然后看下来大概就是: 将字符串HG[3|B[2|AC]]F按照括号里的数量展开 --> HG[3|BACAC]F --> HGBACACBACACBACACF
The text was updated successfully, but these errors were encountered:
function test(str) { const alp = []; let temp = []; for (let i = 0; i < str.length; i++) { if (str[i] !== "[" && str[i] !== "]") { alp.push(str[i]); } else if (str[i] === "]") { while (alp[alp.length - 1] !== "|") { temp.push(alp.pop()); } alp.pop(); //将符号|去掉 const time = Number(alp.pop());//拿到数字 temp = temp.reverse().join("").repeat(time); alp.push(temp); temp = []; } } const res = alp.join(""); return res; }
Sorry, something went wrong.
No branches or pull requests
第一次在面试中碰到出笔试题形式的算法题。上来就是一大段文字,什么小Q小强怎么的,然后看下来大概就是:
将字符串HG[3|B[2|AC]]F按照括号里的数量展开 --> HG[3|BACAC]F --> HGBACACBACACBACACF
The text was updated successfully, but these errors were encountered: