Linked Questions
11 questions linked to/from Tips for golfing in Swift
92
votes
217
answers
23k
views
Find the Factorial!
Create the shortest program or function that finds the factorial of a non-negative integer.
The factorial, represented with ! is defined as such
$$n!:=\begin{...
45
votes
82
answers
5k
views
Print random integers until 0
You are to write a program which generates random integers between \$0\$ and \$99\$ inclusive, outputting each integer in turn, until \$0\$ is generated. You may choose which single-order random ...
33
votes
78
answers
4k
views
Number to Binary
It seems we've managed to go all this time without a plain vanilla Number-To-Binary challenge! Whilst this will inevitably be only one element in many languages, it should put a few esolangs through ...
35
votes
51
answers
11k
views
Code Golf: Your own pet ASCII snake
So, I wrote myself a one-liner which printed out a snake on the console. It's a bit of fun, and I wondered how I might condense my code...
Here's a (short) example output:
...
25
votes
67
answers
9k
views
Compare two numbers given as strings
I have a problem at work. I need to compare two numbers that come as strings from two different databases. The numbers may come with leading zeroes and/or leading/trailing spaces. So I may have ...
49
votes
38
answers
5k
views
Duck, Duck, Josephus
Given an Integer array:
Start from the first number
Jump forward n positions where n is the value of the current position
Delete the current position, making what was the next position the current ...
21
votes
38
answers
3k
views
Find the odd one out
Challenge
The goal of this challenge is to generate and output a \$16 \times 32\$ (height \$\times\$ width) grid where all cells contain a decoy
character, except for a random single cell that ...
33
votes
25
answers
5k
views
The (Easy) Road to Code
Input:
An integer \$n\$, which is guaranteed to be \$\ge3\$.
An integer \$d\$, which is one of \$[-1,0,1]\$.
Output:
A road of size \$n\$, which will be in a north-west direction if \$d=-1\$; a ...
28
votes
26
answers
4k
views
Generate a password
It is very hard to remember my password, so I came up with a way to generate a password.
The way I generate my password is from a word or a sentence, following these steps:
Start from left to right
...
12
votes
21
answers
2k
views
Hexadecimal to Binary
Convert a hexadecimal number (of any size) into a binary number.
Input
A POSITIVE hexadecimal number with a 0x in the beginning. A valid input will always match the ...
-2
votes
53
answers
912
views
Return the highest possible placement value based on the input
Introduction
The challenge itself was something I came across and had to try and figure out for a personal of project of mine. I ended up branching out and asking family members if they could provide ...