We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
for javascript
function processData(input) {
//Enter your code here
var loopNum=input.split("\n")[0];
var inpuJump=1;
for(var i=0;i<loopNum;i++){
var arrSize=parseInt(input.split("\n")[inpuJump]);
var arr=input.split("\n")[inpuJump+1].split(" ");
var sumArr=0;
for(var j=0;j<arrSize;j++){
sumArr+=(parseInt(arrSize)+1)/((parseInt(getLarger(arr,arr[j])))+1);
}
console.log(sumArr.toFixed(2));
inpuJump+=2;
}
function getLarger(arrt,curr){
var count=0;
for(var i=0;i<arrSize;i++){
if(parseInt(arrt[i])>=curr) count++;
}
return count;
}
}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Vertical Sticks
You are viewing a single comment's thread. Return to all comments →
for javascript function processData(input) { //Enter your code here var loopNum=input.split("\n")[0];
}