You are viewing a single comment's thread. Return to all comments →
for java 8+
List<Integer> arrp=arrz,arrn=arrz; int size=arrz.size(); double n=arrn.stream().filter((i)->i<0).count(), z=arrz.stream().filter((i)->i==0).count(), p=arrp.stream().filter((i)->i>0).count(); DecimalFormat df = new DecimalFormat("0.000000"); System.out.println(df.format(p/size)); System.out.println(df.format(n/size)); System.out.println(df.format(z/size));``
Seems like cookies are disabled on this browser, please enable them to open this website
An unexpected error occurred. Please try reloading the page. If problem persists, please contact support@hackerrank.com
Plus Minus
You are viewing a single comment's thread. Return to all comments →
for java 8+