Questions tagged [code-golf]
Code-golf is a competition to solve a particular problem in the fewest bytes of source code.
12,352 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
-1
votes
0
answers
12
views
The string with given properties
Send a message containing "ZCKJSGLZD" ensuring the text length is not 9 and text length is at maximum 25 and text length is at minimum 11 and text length is at minimum 11 and text length is ...
1
vote
2
answers
36
views
Closest Palindromic Number with Matching Smallest Valid Base
An extension of Find the closest palindromic number mixed with Numbers Interpreted in Smallest Valid Base.
A number is a palindrome if its sequence of digits is the same when reading them from left to ...
13
votes
15
answers
1k
views
Rebase Until Inert
This is a sequel to Numbers Interpreted in Smallest Valid Base.
Let us define the operation of rebasing a number as writing out its digits in decimal form, then interpreting them in the smallest base <...
19
votes
13
answers
2k
views
Interpret G-code
G-code is a set of instructions used to manipulate machines in CNC, 3d printing, or other similar applications. It controlls the position of a tool, manuvering it to create a path.
Your goal is to ...
Ted's user avatar
- 2,407
19
votes
28
answers
1k
views
Numbers Interpreted in Smallest Valid Base
Let us define the operation of rebasing a number as writing out its digits in decimal form, then interpreting them in the smallest base N possible (...
-5
votes
13
answers
382
views
Text Flattening Program
Input: A string, can be multi-line. The newlines must to be real newline (e.g., you cannot request that each newline be (n)). There is another input, a number (not ...
15
votes
10
answers
2k
views
Verify a Chinese ID Number
Verify a Chinese ID Number
The Resident Identity Card (居民身份证) is a document issued to most Chinese citizens. It contains information about its holder, including their name, address, and ID number, an ...
11
votes
7
answers
681
views
On the Subject of Switches
This challenge is from a video game, Keep Talking And Nobody Explodes.
A yes or no choice isn’t too bad. Unfortunately you have to make five of them and any of them could be your last. — from the ...
12
votes
12
answers
644
views
Recursive cumulative sum [duplicate]
Challenge:
Given inputs \$i\$ and \$n\,ドル calculate \$R_i(n)\$ where:
$$R_0(n)=n \\
R_i(n)=\sum_{j=0}^nR_{i-1}(j)$$
Note that \$R_1\$ is triangular function, and \$R_2\$ is tetrahedral function.
This ...
10
votes
2
answers
347
views
Check if a number is a power with its program value being a power
Task:
Your task is make a program to check if there exists integers \$a \ge 2, b \ge 2\$ such that \$a^b=i\$ where \$i\$ is the input integer at least 2.
The catch is that your program must return a ...
7
votes
10
answers
1k
views
Return sum of last 3 odd numbers
Introduction
In my CS4 class I worked with another student to golf this lab as much as possible. I learned a lot about Ruby with it, and I am curious what optimizations could be done. :D
Challenge
A ...
-2
votes
0
answers
69
views
How to find the Longest Common Substring among command-line arguments in JS? Hardest golfing [duplicate]
I'm writing a Node.js script that takes multiple strings as command-line arguments and needs to find their Longest Common Substring (LCS). Smallest JavaScript code size wins.
Requirements:
If no ...
11
votes
11
answers
740
views
Find a linear function such that if f(0), f(1), f(2), ⋯ are indices of the elements of the list, the sum must equal to its slope
Challenge:
Find integers \$a\$ and \$b\$ defining linear function \$f(x) = ax + b\$ with \$a > 0, b \ge 0\$ such that the sum of the elements of the input list \$l\$ located at the values of the ...
4
votes
13
answers
810
views
Which letter is missing? [closed]
Given a printable ASCII string, return any letter which is not present (ignoring case), if possible, else return the empty string.
Test Cases:
...
13
votes
4
answers
652
views
Continue the spiral
Write a program or function which, given a clockwise spiral as input, extends that spiral by one character.
When given no input, your function returns the start of the spiral:
...