题解 | #最大间隔#

最大间隔

https://www.nowcoder.com/practice/3a571cdc72264d76820396770a151f90?tpId=182&tqId=34628&rp=1&ru=/exam/oj&qru=/exam/oj&sourceUrl=%2Fexam%2Foj%3Fpage%3D1%26tab%3D%25E5%2590%258D%25E4%25BC%2581%25E7%259C%259F%25E9%25A2%2598%26topicId%3D182&difficulty=undefined&judgeStatus=undefined&tags=&title=

const rl = require("readline").createInterface({ input: process.stdin });
var iter = rl[Symbol.asyncIterator]();
const readline = async () => (await iter.next()).value;

void async function () {
    // Write your code here
    while(line = await readline()){
    A = await readline();
    maxkk(A);
    }
    function maxkk(A){
    As = A.split(' ');
    Aint = As.map(Number);
    res = new Array;
    len = Aint.length;
    for(let i=0; i<len-1; i++){
        res.push(Aint[i+1]-Aint[i]);
    }
    let max=0;
    for(let i=0; i<res.length; i++){
        max=Math.max(max, res[i]);
    }
    console.log(max);
    }
}()

全部评论

相关推荐

废铁汽车人:秋招真是牛鬼蛇神齐聚一堂
点赞 评论 收藏
分享
不愿透露姓名的神秘牛友
10-05 10:13
已编辑
HHHHaos:让这些老登来现在秋招一下,简历都过不去
点赞 评论 收藏
分享
点赞 收藏 评论
分享
牛客网
牛客企业服务