Timeline for Write a program to elasticize strings
Current License: CC BY-SA 3.0
10 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 26, 2017 at 13:20 | comment | added | Kevin Cruijssen |
I know it's been a while, but you can golf it by 1 more byte: interface a{static void main(String[]A){int b=0,B;for(char c:A[0].toCharArray())for(B=b++;B-->=0;)System.out.print(c);}} . (Also, @MarDev said you are now allowed to use functions, so with a Java 8 lambda you can use s->{int b=0,B;for(char c:s)for(B=b++;B-->=0;)System.out.print(c);} , with a char-array as parameter.)
|
|
Apr 13, 2017 at 12:39 | history | edited | CommunityBot |
replaced http://codegolf.stackexchange.com/ with https://codegolf.stackexchange.com/
|
|
Jun 23, 2016 at 20:30 | comment | added | Mario Ishac | Apologies for no clarification, but your answer would still be valid as a function (therefore no interface is needed, as well as the main method). | |
Jun 22, 2016 at 0:45 | comment | added | Justin |
Wow, using an interface for the default public methods. That's smart.
|
|
Jun 21, 2016 at 18:00 | history | edited | user8397947 | CC BY-SA 3.0 |
Shoved off 37 bytes thanks to @KevinCruijssen
|
Jun 21, 2016 at 13:22 | comment | added | Leaky Nun | Well, just make it a lambda or a method | |
Jun 21, 2016 at 6:57 | comment | added | Kevin Cruijssen |
Or even shorter (121 bytes): interface a{static void main(String[]A){int x=0,i;for(char c:A[0].toCharArray())for(i=x+++2;--i>0;)System.out.print(c);}}
|
|
Jun 21, 2016 at 6:50 | comment | added | Kevin Cruijssen |
You can shorten it by 1 byte by replacing for(int C=c+1;C>0;C--) with for(int C=c+2;--C>0;)
|
|
Jun 20, 2016 at 23:47 | comment | added | ave | Huh, this is very short for a Java code. | |
Jun 20, 2016 at 20:03 | history | answered | user8397947 | CC BY-SA 3.0 |