Linked Questions
39 questions linked to/from Tips for golfing in APL
44
votes
64
answers
6k
views
An abundance of integers!
An Abundant number is any number where the sum of its proper divisors is greater than the original number. For example, the proper divisors of 12 are:
...
40
votes
68
answers
6k
views
Random Capitalization
The Task
Your task is to create a program or a function that, given an input, outputs the input text with random letters capitalized, while keeping already capitalized letters capitalized.
Every ...
80
votes
30
answers
12k
views
Create an "H" from smaller "H"s
Challenge
Create a function or program that, when given an integer size, does the following:
If size is equal to 1, output
...
32
votes
43
answers
3k
views
Is this a Permutation of 1..n
Input a non-empty array with \$n\$ positive integers. Test if the input array contains every integer in \$1\cdots n\$.
In case you prefer 0-indexed numbers, you may choose to input an array of non-...
52
votes
30
answers
6k
views
Let's golf a BIBABOBU decoder
While I was traveling in the future, I noticed a funny game among kids circa 2275. When they don't want their great-great-great-great-grand parents to understand what they're saying, they use the ...
20
votes
51
answers
2k
views
Are All the Items the Same?
Given a list of non-negative integers, return whether or not that list is all the same number.
Rules
Input and output can be taken/given in any reasonable and convenient format
Truthy/Falsey values ...
22
votes
53
answers
3k
views
Sum square difference
The sum of the squares of the first ten natural numbers is,
\$1^2 + 2^2 + \dots + 10^2 = 385\$
The square of the sum of the first ten natural numbers is,
\$(1 + 2 + ... + 10)^2 = 55^2 = 3025\$
...
27
votes
33
answers
2k
views
Rotation summation
Take a square matrix containing positive integers as input, and calculate the "rotated sum" of the matrix.
Rotated sum:
Take the sum of the original matrix and the same matrix rotated 90, 180 and ...
18
votes
51
answers
3k
views
The max() is not enough
Intro
A friend posed this question today in a slightly different way - "Can a single [Python] command determine the largest of some integers AND that they aren't equal?".
While we didn't find a way ...
25
votes
31
answers
3k
views
"-rot" transform
Background
-rot transform (read as "minus-rot transform") is a sequence transformation I just invented. This transform is done by viewing the sequence as a stack in Forth or Factor (first ...
28
votes
26
answers
3k
views
Print the sequence
21, 21, 23, 20, 5, 25, 31, 24, ?
Inspired by this Puzzle, given an integer \$n>0\$ , print out the following sequence until you reach a non-Integer (spoilered, in case you want to solve the puzzle ...
33
votes
27
answers
3k
views
Find the nearest greater number
The task
Given any array of integers, e.g.:
[-1,476,578,27,0,1,-1,1,2]
and an index of that array (this example uses 0 based indexing, though you can use 1 based ...
19
votes
28
answers
2k
views
Pendulum Encoding
Given a string as an input (which can be any acceptable/convenient format in your language), implement pendulum encoding. The test cases are split into individual items (which aren't quoted) for a ...
18
votes
34
answers
3k
views
Pythagorean triples given the hypotenuse
Definition (from Wikipedia)
A Pythagorean triple consists of three positive integers a, b, and c, such that a² + b² = c².
The typical example of a Pythagorean triple is (3,4,5): 3² + 4² = 9 + 16 = 25 ...
27
votes
25
answers
4k
views
ASCII art reflection
In this challenge, you will be given a text block, and you need to perform reflection on the text.
Input:
A string to be reflected. The text may not be supplied as an array whose elements are the ...