Posts by Quintec
Every outcome must be possible For example, if the challenge requires a random number from 1-5, all 5 numbers must be possible. It does not need to be uniformly random (unless otherwise specified)...
Japt, 1 byte u Japt, more like JABT (just another builtin) :P Try it
You have an army of size $n$ that you need to split up to fight $k$ battles simultaneously against an opposing army $A$. In each battle, the army with the most troops present wins - no one wins a t...
Japt -R, 14 13 bytes ;Bãê kb'A û ê Test it Takes all substrings of the alphabet, palindromizes them, and then takes only the ones starting with A and centers and mirrors that too. -1 byte tha...
Japt, 1 byte w Uh... yeah. Probably similar solutions for many other golf langs. Try it
Regarding because the vast majority of all programs that were posted & highly up-voted there won't even compile on the most basic, compliant compiler for that language. Code Golf allows f...
Python 3, 49 47 44 35 bytes a=lambda x,y:+(x>=0)and(1+a(y,x-y)) Try it online! -3 bytes thanks to @Hakerh400 -9 bytes thanks to @Jo King Python 2, 50 bytes x,y=input() a=0 while...
Japt, 12 bytes ÊÆgX *VpXÃr+ Loops through the range of integers 0 to n-1, calculates each term, and sums. Try it
Recently a flag came to my attention on this post: https://codegolf.codidact.com/posts/280372/281943#answer-281943 It is a well-intentioned answer to the challenge, but unfortunately it is wrong, ...
Use higher versions of Java Seriously, it's crazy what sort of features have been added since Java 8. I hardly recognize the language anymore... Examples: Constructing Lists Before, you had to ...
Japt, 14 11 8 bytes £¯YÄ è¥X Try it -3 bytes thanks to @Shaggy
Given a musical key, output its number and letter on the Camelot Wheel (shown below). Input A musical key as a string, as shown on the wheel. The words "Sharp" and "Flat" may be replaced with s...
Laser, 9 bytes c⌜ps \U# My own language's showcase time! This is a 2D language with an instruction pointer initially pointing to the right. It takes implicit input as an array of characters. ...
Given an array of numbers, output the length of the longest increasing (not necessarily contiguous) subsequence. It is guaranteed that there are no duplicates in the array. For example, if the inpu...
Japt -P, 7 2 bytes Õc Takes input as character arrays. -5 bytes thanks to @Shaggy Try it
Japt -R, 28 bytes Lõ@"Fizz"pXv3)+"Buzz"pXv5)ªX I spent a long time playing with wizardry string/array slicing. It did not work out. This solution just repeats "Fizz" and "Buzz" if divisible. T...
Japt, 1 byte ½ Test it Jelly, Vyxal, 1 byte . Try it online! Yeah, golf langs still kind of kill this challenge.
Japt -Q, 15 12 bytes à üÊËx_×*JpE -3 bytes thanks to @Shaggy Uses Vieta's. Try it
Canvas, 9 7 bytes #*⌐⤢n↔n -2 bytes thanks to @Razetime Uh I don't really know how to use Canvas - what I think this does is create the vertical wall, then half the horizontal one, then concatn...
The "Uppers" def oneup(data, history): if len(history) > 0: prev = history[-1] if prev[2] > 1: better = [prev[0] + 1, prev[1] + 1, prev[2] - 2] elif prev[1] > 1: better...
What is random defined as on this site? How are answers allowed to handle random chance?
APL (Dyalog Classic), 20 18 17 16 bytes ⊢/,+.×⍣⎕⍨∘.+⍨⌽⍳2 Matrix implementation, requires ⎕IO←0. Thanks to @Razetime for the idea, -3 bytes by me Try it online! APL (Dyalog Classic), 19 18 byt...
Python 3, 39 bytes f=lambda x:x if x<2else 2*f(x-1)+f(x-2) Generic recursive implementation Try it online!
With equally great hesitation, I'll also throw my hat in the ring if Jo King does not respond. (If he does, I'd rather Chris be the second moderator.) I was on the PPCG SE site for a relatively lo...
Japt, 11 bytes `HÁM, Wld! Just using Japt's builtin compression. Test it
- ← Previous
- 1
- 2
- 3
- Next →
