Posts by Shaggy
Challenge A catalogue type challenge that simply asks: Given an integer n (where n>=0) as input return a truthy value if n is a perfect square or a falsey value if not. Rules You may take...
Challenge Given a list of unique colour names as input, sort them in the order that they first appear in Joseph's Amazing Technicolour Dreamcoat. Example Input: green, blue, red, brown Outpu...
Challenge Given an integer n>=4 as input create an ASCII art "prison door"* measuring n-1 characters wide and n characters high, using the symbols from the example below. Example ╔╦╗ ╠╬╣ ...
Japt, 11 10 bytes >0©ÒßUÉ/°T Try it >0©ÒßUÉ/°T :Implicit input of integer U >0 :Greater than 0? © :Logical AND with Ò :Negate the bitwise ...
Japt, 27 Solutions This started out as a collaboration with Quintec but quickly got very out of hand! Posted with their permission. More solutions to follow. Hopefully! 256 Try it Just the b...
Inspired by this challenge. If anyone has any suggestions for a song title I could use for the challenge title then please leave a comment. Definition We define f(x) for a given integer as the su...
Japt -x, 6 5 bytes Ë*VpE Try it Ë*VpE :Implicit input of array U and float V Ë :Map each element D at 0-based index E * : Multiply D by VpE : V raised to the pow...
JavaScript, 28 bytes f=n=>n-1&&-~f(n%2?n*3+1:n/2) Try it online!
JavaScript (V8), 44 bytes a=>a.map((a,x)=>a.map((n,y)=>n&&print(x,y))) Try it online!
Japt, 3 bytes e¡g Try it e¡g :Implicit input of array U e :Is equal to ¡ :Map U g : First element of U
Japt -h, 19 18 bytes Gõ ñ@ìX xg#5#}4s3 Try it Gõ ñ@ìX xg#5#}4s3 :Implicit input of integer U G :16 õ :Range [1,G] ñ :Sor...
Python, 45 bytes I am not a Python guy at all, so I'm quite proud of this. I'm sure, though, there's something simple I could be doing to save myself a few bytes! lambda n:int(n,int(max("1"+n),...
Japt -x, 6 5 bytes Takes input as an array of integers p!UdÍ Try it p!UdÍ :Implicit input of array U p :Push ! : Logical NOT of Ud : Any true (not zero) when ...
Japt, 610 606 bytes Don't think there's anything more that can be done with it than this. 933î`'T°s ߦg, d e sÒy v Did gy d g½e e °¼; A¥ Úßy ØÀ e Þgov, A e Ú ÎÈs tg¼.0"BeØ ...
Rockstar, 76 bytes Takes individual integers as input. listen to f let n be f o's1 while n let o be o and n is f listen to n say o Try it (Code and input will need to be added manually...
Japt, 4 bytes P1 is: +"+U Try it Which outputs P2, where N1 is the input from P1: N1+U Try it
Japt -R, 16 15 14 bytes pÔ¬Ëú°EDùEÃÆpÔ Try it pÔ¬Ëú°EDùEÃÆpÔ :Implicit input of string p :Append Ô : Reverse ¬ :Split Ë ...
Japt -N, 9 bytes ¨T©ÒßVVnU Try it ¨T©ÒßVVnU :Implicit input of integers U & V ¨ :U is >= T : 0 © :Logical AND with Ò :Negate the...
Japt, 17 bytes Needs some more work. É?[U]cßÂUp½+Uu:1ì Try it If there's a proof that the length of the sequence for any given n never exceeds n**3 then ... Japt, 14 bytes NcU³Æ=Âp½+UuÃâ ...
JavaScript, 20 bytes Outputs false for truthy and true for falsey. a=>a.some(x=>x-a[0]) Try it online! Outputs true and false as normal. a=>new Set(a).size<2 Try it online!
Japt -m, 5 bytes Takes input in reverse order. Sadly, Japt has no minimum built-in for strings. VcmUc Try it VcmUc :Implicit map of each U in the first input string V :Second inp...
JavaScript, 37 bytes I/O as character arrays. a=>b=>b.flatMap(x=>a.map(y=>x<y?x:y)) Try it online!
JavaScript, 25 bytes The function is called with f(g)(n), where g is a function. g=>h=n=>n-1?g(h(n-1),n):1 Try it online!
Japt -m, 8 7 bytes ð òÎmiV Try it ð òÎmiV :Implicit map of each sub-array at 0-based index V ð :Indices of truthy (i.e., non-zero) elements ò :Partition between eleme...
Japt -R, 12 bytes õÈ"/\\"mpXÃû Try it õÈ"/\\"mpXÃû :Implicit input of integer õ :Range [1,input] È :Map each X "/\\" : Literal string m ...