牛客971465536号
牛客971465536号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客971465536号的博客
全部文章
/ 题解
(共50篇)
题解 | #判断回文#
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param str string字符串 待判断的字符串 * @return bool布尔型 */ function judge( str ) { let arr = str.split...
Javascript Node
2021-10-28
4
467
题解 | #斐波那契数列#
function Fibonacci(n) { n = parseInt(n); if (n < 2) { return 1; } else { let arr = new Array(n).fill(1); for (let i= ...
Javascript Node
2021-10-28
0
312
题解 | #矩阵乘法#
while(line = readline()) { let x = parseInt(line); let y = parseInt(readline()); let z = parseInt(readline()); let A = []; let B ...
Javascript V8
2021-10-28
3
472
题解 | #24点游戏算法#
//类似深度搜索 let status; while(line = readline()) { let arr = line.split(' ').map(x => parseInt(x)); status = false; dfs(-1, 0, arr, status...
Javascript V8
2021-10-27
2
483
题解 | #查找两个字符串a,b中的最长公共子串#
let arr = [] let n = 2; while(line = readline()) { arr.push(line); } for (let s= 0; s< arr.length/n; s++) { let items = arr.slice(n*s, n*(...
Javascript V8
2021-10-27
0
551
题解 | #DNA序列#
let arr = []; while(line = readline()) { let num = readline(); for (let i=0; i<=line.length - num; i++){ //先切片 arr.push(line.substr...
Javascript V8
2021-10-27
0
347
题解 | #查找组成一个偶数最接近的两个素数#
while(line = readline()) { let num = parseInt(line); // x + y = num && y - x = diff let diff; for (let i=0; i<= num/2; i++)...
Javascript V8
2021-10-27
0
458
题解 | #查找组成一个偶数最接近的两个素数#
while(line = readline()) { let num = parseInt(line); let diff = 9999999999; for(let start=1; start <= num/2; start++) { for (le...
Javascript V8
2021-10-27
0
450
题解 | #找出字符串中第一个只出现一次的字符#
while(line = readline()) { const arr = line.split(''); let result = arr.reduce((temp, data) => { temp[data] = temp[data] ? temp[da...
Javascript V8
2021-10-27
0
425
题解 | #高精度整数加法#
//数字超过了NUMBER.MAX_SAFE_INTEGER,所以这里使用对位相加,写的有点烂,凑活看 let arr = [] let n = 2; while(line = readline()) { arr.push(line); } for (let i = 0; i<arr...
Javascript V8
2021-10-27
0
576
首页
上一页
1
2
3
4
5
下一页
末页