Timeline for The shortest code to invert bit-wise a binary string
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 1, 2015 at 2:55 | comment | added | Paŭlo Ebermann | @aditsu one needs to get 10 points (= at least one answer or 2 question upvotes) on this site – the 100 rep from the association bonus doesn't count. | |
Jun 12, 2014 at 18:36 | comment | added | hdante | Thanks, to tell the truth, it's not as verbose as I expected it to be. | |
Jun 11, 2014 at 12:14 | comment | added | aditsu quit because SE is EVIL | @JanusTroelsen Protected means you need to have at least 10 reputation to answer, and you have 101. I don't think grouping answers as comments really makes sense. | |
Jun 11, 2014 at 11:18 | comment | added | Janus Troelsen | The question has been protected. I also think it makes sense to group answers by language. You are correct, they are longer, when expressed in this syntax. | |
Jun 11, 2014 at 11:08 | comment | added | aditsu quit because SE is EVIL | @JanusTroelsen Um, thanks, but why don't you post a separate answer? Also, your solutions are longer. | |
Jun 11, 2014 at 10:48 | comment | added | Janus Troelsen |
reads everything from stdin with the Scanner trick (165 bytes): class A{public static void main(String[] b){for(char a:new java.util.Scanner(System.in).useDelimiter("\\A").next().toCharArray())System.out.print(a=='0'?'1':'0');}}
|
|
Jun 11, 2014 at 10:47 | comment | added | Janus Troelsen |
reads ACSII from stdin (143 bytes): class B{public static void main(String[] b)throws java.io.IOException{int c;while((c=System.in.read())!=-1)System.out.print(c=='0'?'1':'0');}}
|
|
Jun 11, 2014 at 10:46 | comment | added | Janus Troelsen |
a solution that takes the word "random" in the question literally and makes it's own input: class C{public static void main(String[] b){new java.util.Random().ints(0,2).forEach((int i)->System.out.print(i==0?'1':'0'));}}
|
|
Jun 11, 2014 at 10:45 | comment | added | Janus Troelsen |
a streaming Java 8 solution (takes lines of 0 and 1): class D{public static void main(String[] b){new java.io.BufferedReader(new java.io.InputStreamReader(System.in)).lines().forEach((String i)->System.out.print(i.equals("0")?'1':'0'));}}
|
|
Jun 11, 2014 at 8:36 | history | edited | aditsu quit because SE is EVIL | CC BY-SA 3.0 |
shortened
|
Jun 11, 2014 at 5:52 | history | edited | aditsu quit because SE is EVIL | CC BY-SA 3.0 |
shortened
|
Jun 11, 2014 at 5:32 | history | answered | aditsu quit because SE is EVIL | CC BY-SA 3.0 |