You are viewing a single comment's thread. Return to all comments →
Java Solution: Passes all Testcases.
public static void main(String[] args) { Scanner in = new Scanner(System.in); String line = in.nextLine().replace(" ",""); int cols=(int)Math.ceil(Math.sqrt(line.length())); for(int index = 0;index<cols;index++) { StringBuffer sB = new StringBuffer(); for (int i=index; i < line.length() && i < (i + cols); i+=cols) { sB.append(line.charAt(i)); } System.out.print(sB.toString()+" "); } }
Seems like cookies are disabled on this browser, please enable them to open this website
Encryption
You are viewing a single comment's thread. Return to all comments →
Java Solution: Passes all Testcases.