mari sum

Run Settings
LanguageJavaScript
Language Version
Run Command
function processData(input) { var max_count , min_count ,str , n ,arr , max ,min; max_count = 0 ; min_count = 0 ; max = 0; min = 0; str = input.split('\n'); n = Number(str[0]); arr = str[1].split(' '); for (let i = 0; i < n; i++) { if (i == 0) { max = Number(arr[i]); min = Number(arr[i]); } if (i>0 && Number(arr[i]) > max ) { max = Number(arr[i]); max_count++; } if (i>0 && Number(arr[i]) < min) { min = Number(arr[i]); min_count++; } } console.log(max_count + " " + min_count); } process.stdin.resume(); process.stdin.setEncoding("ascii"); _input = ""; process.stdin.on("data", function (input) { _input += input; }); process.stdin.on("end", function () { processData(_input); });
Editor Settings
Theme
Key bindings
Full width
Lines