You are viewing a single comment's thread. Return to all comments →
public static int squares(int start, int end) { int startVal = (int)Math.sqrt(start); int endVal = (int)Math.sqrt(end); int sqrtcount = 0; sqrtcount = (int)IntStream.rangeClosed(startVal, endVal). filter(a -> { int srt = a*a; return srt >= start && srt <=end; }).count(); return sqrtcount; }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and Squares
You are viewing a single comment's thread. Return to all comments →