牛客971465536号
牛客971465536号
全部文章
题解
归档
标签
去牛客网
登录
/
注册
牛客971465536号的博客
全部文章
/ 题解
(共32篇)
题解 | #删除字符串中出现次数最少的字符#
while(line = readline()) { let str = line; let result = line.split('').reduce((temp, data) => { temp[data] = temp[data] ? temp[data...
Javascript V8
2021-10-30
7
1317
题解 | #最长回文子串#
/** * 代码中的类名、方法名、参数名已经指定,请勿修改,直接返回方法规定的值即可 * * @param A string字符串 * @param n int整型 * @return int整型 */ export function getLongestPalindrome(A:...
Typescript
Javascript V8
2021-10-28
0
345
题解 | #最长无重复子数组#
/** * * @param arr int整型一维数组 the array * @return int整型 */ function maxLength( arr ) { if (arr.length < 2) { return arr.length; ...
Javascript V8
2021-10-28
0
315
题解 | #两数之和#
/** * * @param numbers int整型一维数组 * @param target int整型 * @return int整型一维数组 */ function twoSum( numbers , target ) { let arr=[] f...
Javascript V8
2021-10-28
0
373
题解 | #矩阵乘法#
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
475
题解 | #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
487
题解 | #查找两个字符串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
552
题解 | #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
348
题解 | #查找组成一个偶数最接近的两个素数#
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
463
题解 | #查找组成一个偶数最接近的两个素数#
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
首页
上一页
1
2
3
4
下一页
末页