Last active
April 23, 2017 15:11
-
-
Save nhojpatrick/7a39f67472723a3dce74d41b3e27551d to your computer and use it in GitHub Desktop.
1 Loop & 1 StringBuilder
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Pattern { | |
public static void main(final String[] args) { | |
final StringBuilder sb = new StringBuilder(); | |
for (int i = 1; i <= 7; i++) { | |
System.out.println(String.format("%s %s %s", sb.toString(), i, sb.reverse())); | |
sb.reverse().append(" " + i); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment