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.
functionsolve(array$h,int$limit,array$queries){$res=[];for($k=0;$k<count($queries);$k++){$count=0;for($i=$queries[$k][0];$i<=$queries[$k][1];$i++){for($j=$queries[$k][1];$j>0;$j--){if($i==$j)break;if(abs($h[$i]-$h[$j])>$limit)continue;$count++;}}$res[]=$count;}return$res;}#change run oprion to:$result=solve($h,$k,$queries);
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Almost Equal - Advanced
You are viewing a single comment's thread. Return to all comments →
PHP solution error "Time limit exceeded"
code: