You are viewing a single comment's thread. Return to all comments →
Java 8
static String aDecentNumber(int n) { int temp = n; while (temp >= 3) { if (temp % 3 == 0) { return fillNo(5, temp) + fillNo(3, n - temp); } temp -= 5; if (temp == 0) { return fillNo(3, n); } } return "-1"; } static String fillNo(int no, int times) { StringBuffer sb = new StringBuffer(); for (int i = 0; i < times; i++) { sb.append(no); } return sb.toString(); }
Seems like cookies are disabled on this browser, please enable them to open this website
Sherlock and The Beast
You are viewing a single comment's thread. Return to all comments →
Java 8