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.
This codes give the exact output for all test cases ,yet the compiler shows wrong output! Can anyone tell me whats wrong into this code`
publicstaticStringbalancedSums(List<Integer>array){// Write your code hereInteger[]arr=(Integer[])array.toArray(newInteger[array.size()]);int[]pref=newint[arr.length];pref[0]=arr[0];for(inti=1;i<arr.length;i++){pref[i]=pref[i-1]+arr[i];}for(inti=0;i<arr.length;i++){if((pref[i]-arr[i])==pref[arr.length-1]-pref[i]){return"Yes";}}return"NO";}
Cookie support is required to access HackerRank
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Array
You are viewing a single comment's thread. Return to all comments →
This codes give the exact output for all test cases ,yet the compiler shows wrong output! Can anyone tell me whats wrong into this code`