text stringlengths 180 608k |
|---|
[Question]
[
*EDIT: I'm getting a lot of comments about this not terminating - I will give the "correct answer" tag to either the first person who gives me `FF(3)` (as in provides it in their answer) or proves that `FF(3)` does indeed blow up indefinitely.*
## Task:
Your task is make the smallest program possible... |
[Question]
[
This challenge is based on another similar challenge. Because finding the most efficient packing of rectangles is NP-hard (that is, its solution is easy to check but hard to find), this challenge is a lot easier than this one [here](https://codegolf.stackexchange.com/questions/96901/arranging-arbitra... |
[Question]
[
*In honor of [recent news of Google developing a keyboard for iPhone](http://bgr.com/2016/03/23/google-keyboard-app-ios-iphone-gif-search/)...*
Your input (for simplicity, all input is case sensitive):
1. Location of standard dictionary file. File format is 1 valid word per line; in alphabetical orde... |
[Question]
[
# Introduction
File names can be wildly varying things, ranging from a simple `blah.txt` to `303549020150514101638190-MSP0.txt`. The former is usually human generated, while the latter is often machine generated. Wouldn't it be nice to have a simple function to make educated guesses on whether or not... |
[Question]
[
This is the third in a series of puzzles that I will be posting every Monday at Midnight PST, and the final variant of "Take It or Leave It".
The first puzzle is located [Here](https://codegolf.stackexchange.com/questions/54147/take-it-or-leave-it-a-game-show-for-computers)
The second puzzle is locat... |
[Question]
[
Write the smallest program you can to create affine fractals. You may use any method you feel like that generates the same results as the rules below. You don't have to use any ideas from the suggested methods!
Your program will take two inputs, the first to define the pattern in the format `074` mad... |
[Question]
[
This challenge is to compute the most efficient [multiplication order](http://en.wikipedia.org/wiki/Chain_matrix_multiplication) for a product of several matrices.
The size of the matrices is specified on a single line of standard input. You should print to standard output a list of integers indicati... |
[Question]
[
What general tips do you have for golfing in Chef? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Chef (e.g. "remove unnecessary whitespace" is not an answer).
Please post one tip per answer.
]
|
[Question]
[
Find the moves that bring a chess squad to a given destination.
You control a chess squad consisting of a king and several other pieces, on a larger chess board. Your army is placed so that no piece is further than K=8 squares away (horizontally and vertically) from your king. You will receive a dest... |
[Question]
[
[Conway's Game of Life](https://en.wikipedia.org/wiki/Conway%27s_Game_of_Life) is a well known cellular automaton "played" on an infinite grid, filled with cells that are either alive or dead. Once given an initial state, the board evolves according to rules indefinitely. Those rules are:
* Any live ... |
[Question]
[
I need to construct a functor that iterates over the linear representation of a sub-lattice of size \$d\_x,d\_y,d\_z,d\_q\$ embedded in a lattice of size \$n\_x,n\_y,n\_z,n\_q\$. The sub-lattice corner is shifted by \$(l\_x,l\_y,l\_z,l\_q)\$.
Since the functor can be called million of times, the goa... |
[Question]
[
While idly twisting my [Rubik's cube](https://en.wikipedia.org/wiki/Rubik%27s_Cube) around, my son noticed that it kept going back to the solved state. I'm pretty sure he thought this was some sort of voodoo magic at first, but I explained that if you keep repeating the same sequence of moves, it wil... |
[Question]
[
[Fairy Chess](https://en.wikipedia.org/wiki/Fairy_chess_piece) is a sort of generalized chess that allows unconventional pieces. [The eight queens puzzle](https://en.wikipedia.org/wiki/Eight_queens_puzzle) is a classic problem where you have to put 8 queens on a chess board such that no two queens th... |
[Question]
[
The barbells at my gym look like this:
```
=========[]-----------------------[]=========
```
They can hold plates of five different sizes, 2.5 pounds, five pounds, ten pounds, 25 pounds, and 45 pounds:
```
.
. ! |
. ! | | |
| | | | |
' ! | | |
... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/6284/edit).
Closed 6 years ago.
[Improve this question](/posts/6284/edit)
... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win.
Closed 6 years ago.
[Improve this que... |
[Question]
[
**Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers.
---
This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic).
Closed 9 years ag... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/15954/edit).
Closed 10 years ago.
[Improve this question](/posts/15954/edit... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/12397/edit).
Closed 1 year ago.
[Improve this question](/posts/12397/edit) ... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/43218/edit).
Closed 9 years ago.
[Improve this question](/posts/43218/edit)... |
[Question]
[
Your program has to have an year like `1957` to be the input and then output the century of that year.
For example:
```
In: 1946
Out: 20
In: 1705
Out: 18
In: 1900
Out: 19
In: 100
Out: 1
In: 2001
Out 21
```
because 1946 is in the 20th century.
Keep in mind that 2000 should be 20th century or 1900 shou... |
[Question]
[
Unlolify a lolified message!
I had to ask a coworker if they wanted to have lunch with me, but we're both hackers so it could not be in a lame way. The message asking that was roughly this:
>
> please respond with `011110010110010101110011` if you'd like to join lunch today
>
>
>
The colleague be... |
[Question]
[
Your task is to print out this exact text:
```
-
||
-|-
|---
|-|--
-|-|--
-|-----
|-|-----
|---|-|--
-|-----|--
---|-|-----
|---|-|-----
|---|-----|--
-----|---|-|--
-|-|---|-------
------|---|-----
|-|---------|-|--
---|-----|---|----
-|-----|-|---------
|-|---|-|-----------
|-----------|---|-|--
-|... |
[Question]
[
## Challenge:
Given the input array `l` with a list of strings, only keep the elements in the sequence that have a letter that's repeated at least 3 times. Like `'lessons'` has 3 `s` letters, so it should be kept in the sequence. But, `'lesson'` has only two `s` letters, so it should be removed.
## N... |
[Question]
[
This problem is inspired from [shinh's problem](http://golf.shinh.org/p.rb?Smileys+Triangle).
Given an input of positive integer \$n\$, output a smiley triangle (see below) with \$n\$ rows.
## Detailed rules
* Can be either a function or a full program.
* Standard I/O rules applied.
+ **RULE CLARIFI... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/10532/edit).
Closed 3 years ago.
[Improve this question](/posts/10532/edit)... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/9309/edit).
Closed 7 years ago.
[Improve this question](/posts/9309/edit)
... |
[Question]
[
## Problem
You've stumbled upon a paradoxical mathematical phenomenon related to prime numbers. Consider the following scenario:
You have an infinite list of prime numbers: $$2, 3, 5, 7, 11, 13, 17, 19, ...$$
Now, you decide to pair up these prime numbers in a way that each prime is paired with its c... |
[Question]
[
Not restricted to any one programming language.
What I'm saying is you pass 1 to it and it returns Monday, 7 corresponds with sunday and so on.
I've managed a 146 byte statement in Java to do the same.
```
return (n<1?"invalid":(n<2?"monday":(n<3?"tuesday":(n<4?"wednesday":(n<5?"thursday":(n<6?"frid... |
[Question]
[
Suppose A and B are two good friends. A has borrowed \$n\$ dollar from B. Now B wants the money back from A and A is also ready to give it. But the problem is A has only \$x\$ dollar notes and B has \$y\$ dollar notes. They both want to keep the number of notes in exchange as low as possible.
As an e... |
[Question]
[
Seeing as there have been an awful lot of normal Fibonacci challenges, I decided that it might be interesting to calculate the [Reciprocal Fibonacci constant](http://en.wikipedia.org/wiki/Reciprocal_Fibonacci_constant) - namely, the sum of the reciprocals of the Fibonacci sequence.
The challenge is t... |
[Question]
[
Given the input `tilesX` and `tilesY` create a method that would make a rectangular ring from the tiles.
The function must order the tiles in a ring like this:
[](https://i.stack.imgur.com/Be2zp.jpg)
* `tilesX` and `tilesY` are alway... |
[Question]
[
You left your computer for too long, and it went to sleep. Wake it up again by printing the following coffee maker.
```
________._________
| | \ - /
| || | \ - /
| || |___\___/
| || | X
| | ___
| | / - \
|______| / - \
| ____ | /_______\
||7:30||__________
||__... |
[Question]
[
This is a very simple challenge.
The joke language InterpretMe consists of one command; `*`, which causes the program to take input of an InterpretMe program and execute it.
An InterpretMe program will interpret as many InterpretMe programs as there are `*` in input.
---
Your goal is to create a pro... |
[Question]
[
## Challenge
Given an array of single digit number, work out if any 2 of them add up to 10 and print them out
## Example
**Input**
>
> (1,2,3,4,5,5,6,7)
>
>
>
This returns `((4,6),(5,5),(3,7))`
**Input**
>
> (1,2,3,4,5)
>
>
>
This returns `()`. as there is only one 5
**Input**
>
> (5,5,5,5,5... |
[Question]
[
# The Question
Given a set of 9 numbers, `m[]`, which contains only numbers 1 through 9 in a random order, with no two numbers being the same, create a program in any language which rearranges the number to be in numerical order (1, 2, 3, etc. etc.) by **only** switching two numbers which are next to... |
[Question]
[
A ragged matrix, is a matrix that has a different number of elements in each row. Your challenge is to write a program in any favorable language to find the indices of all occurrences of target in the ragged matrix.
# Input:
A list of ragged lists (can be empty) of positive integers and a target rang... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/18435/edit).
Closed 6 years ago.
The community reviewed whether to reopen t... |
[Question]
[
For context, this problem is based on a old chat-bot project I did.
# Problem:
Given a string of words containing any of the characters:
```
" !\"#$%&'()*+,-./0123456789:;<=>?@ABCDEFGHIJKLMNOPQRSTUVWXYZ[\\]^_`abcdefghijklmnopqrstuvwxyz{|}~"
```
Find the frequency of each triplet of words. All non-alp... |
[Question]
[
Let's say I've got a list (or array) of:
```
l = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]
```
I want to get the third Cartesian power of the above list, where we take every possible triple of elements from `l`.
Then I want to filter and only keep the sublists where the sum of that sublist equal to the maximum... |
[Question]
[
Given a list of coordinate pairs, output the Trapezoidal Riemann Sum of the values given between the first and last x-coordinates.
You will be given a sorted list of coordinate pairs, like this:
```
[
[1,2],
[3,5],
[5,11]
]
```
Note that x-coordinates will always be in increasing order, ys may ... |
[Question]
[
A class has N student and the class room has N switches (all turned OFF and numbered 1 to N). Each student has an enrollment number assigned from 1 to N. Each student serially (by number) toggles the switches that has a number which is divisible by his/her enrollment number.
Example: Student 1 will t... |
[Question]
[
Inspired by a challenge from the [OUCC 2022 Seniors competition](https://challenge.bebras.uk/index.php?action=anon_join&grp_id=12427).
### Background
Two teams are playing "capture the flag". They take turns invading each other's base and capturing their opposing team's flag in the shortest amount of... |
[Question]
[
**Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/15678/edit).
Closed 6 years ago.
[Improve this question](... |
[Question]
[
There is a [question](https://codegolf.stackexchange.com/questions/487/implement-division) on the site that asks to implement division without using division.
In my case, I am asking you to do the same, but only using addition.
What this means is basically: addition is the only operator or function a... |
[Question]
[
Yesterday, as part of a IQ-style test, I got this interesting question:
>
> The time on a 24-hour clock is 11:43. What is the least number of minutes I should wait before the same digits are on the screen again (in any valid 24-hour time order)?
>
>
>
The answer's 91 minutes, if you were wonderin... |
[Question]
[
# Challenge
Write a program that greets a user depending on what time of day (GMT) it is.
# Output
A string (printed or returned) according to these rules:
* If the time is 06:00 to 11:59 the greeting has to be "Good morning"
* If the time is 12:00 to 17:59 the greeting has to be "Good afternoon"
... |
[Question]
[
This is the robbers' thread. For the cops' thread, click [here](https://codegolf.stackexchange.com/questions/99469/quine-anagrams-cops-thread).
### Cops' Task
For the cops' thread, click [here](https://codegolf.stackexchange.com/questions/99469/quine-anagrams-cops-thread).
### Robbers' Task
* Find an... |
[Question]
[
Inspired by <http://meta.codegolf.stackexchange.com/questions/547/write-a-code-golf-problem-in-which-script-languages-are-at-a-major-disadvantage> question on meta, I've decided to make a question which could be problematic for scripting languages.
The goal is to calculate fast inverse square root, j... |
[Question]
[
## Story
The god of base is opening heaven’s gate for mortals to join the base party. You, as one of the believers, want to follow their steps to ascend to heaven.
But not everyone can get in.
The god posts this question to let you prove you are worthy of their party.
## Task
You will get 2 inputs
* ... |
[Question]
[
When I was in grade 3, we were taught how to solve a very simple math problem. It was equaling the denominators of two or more fractions.
Let's take two proper fractions:-
$$
\frac{1}{2},\frac{2}{3}
$$
First we will take the Least Common Multiple of the denominators of the two fractions, the LCM of \... |
[Question]
[
## Input
Take a list of values **xi** each paired with a key **yi**.
```
[(x1, y1), (x2, y2), ...]
```
## Output
Return a list **L** containing only values from the set {**xi**}.
* The length of **L** must be equal to the number of unique keys **k** in the set {**yi**}.
* For each unique key **k** t... |
[Question]
[
## Challenge
You must write a program which takes a string and a flag as input and performs one of the following functions.
## Input
If your language does not support command line arguments, you may take the arguments as input via STDIN.
The flag will be two characters: a dash and an ASCII character ... |
[Question]
[
**This question already has answers here**:
[Simplify a fraction](/questions/35587/simplify-a-fraction)
(20 answers)
Closed 8 years ago.
**Note: as this question has been marked as a duplicate, I have accepted an answer. However, I will still check this question if users can find a shorter way... |
[Question]
[
**This question already has answers here**:
[Prime Factorization - but on the exponents too](/questions/226691/prime-factorization-but-on-the-exponents-too)
(7 answers)
Closed 2 years ago.
Your job is to take the prime factors of a number taken from input (omitting any exponents equal to 1) th... |
[Question]
[
**Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers.
---
**Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/12876/edit).
Closed 7 years ago.
[Improve this question](/posts/12876/edit)... |
[Question]
[
This quite literally came to me in a dream.
A common combination padlock design has letters on the dials so you can set the combination to a word. Unfortunately, I can't read, but I can count. Considering I am in a hurry, send the shortest path around the dials to open the 4 letter lock, given the cu... |
[Question]
[
[OEIS sequence A003242](https://oeis.org/A003242) comprises the numbers of Carlitz compositions for any given positive integer. This is the number of integer partitions of the integer for which no two adjacent parts are equal.
For example, for 4:
1. Generate the possible integer partitions (and their... |
[Question]
[
The autokey cipher is closely related to the Vigenère cipher (both were invented by Blaise de Vigenère). Decryption involves the encrypted message and the key. For simplicity, let us assume all characters in the message and key are lowercase letters (no spaces, numbers or symbols etc.).
## How to d... |
[Question]
[
## Challenge
To quote [Wikipedia](https://en.wikipedia.org/wiki/Scale_(music)#Background):
>
> An octave-repeating scale can be represented as a circular arrangement
> of pitch classes, ordered by increasing (or decreasing) pitch class. For instance, the increasing C major scale is C–D–E–F–G... |
[Question]
[
# What is elementary cellular automata?
Since I'm not sure I'll be able to explain this so that somebody who has never heard of this is able to understand, I'm giving an explanation from <https://mathworld.wolfram.com/ElementaryCellularAutomaton.html>
>
> Elementary cellular automata have two possib... |
[Question]
[
Write a program that prints the RGB color of a given pixel on the screen.
The program should read a line from stdin in the format `x,y`, where x and y are unsigned integers. The pixel (0,0) is the top left pixel in the screen.
The program should then output a line to stdout in the format `RRR,GGG,BBB... |
[Question]
[
Inspired and looted from [this dice challenge by Arnauld](https://codegolf.stackexchange.com/questions/169919/how-much-is-my-dice-matrix-worth)
# Input
You are given a 5x1 or 1x5 (your choice) dice matrix which consist of binary 3x3 sub-matrices.
# Goal
Given a valid dice matrix, you are to score it ... |
[Question]
[
## Description
While support is getting better and better for people to write in various scripts around the world using unicode, and now you can even write in emojis as well, unfortunately most fonts[citation needed] are still missing Latin characters based on the double acute accent, which is requir... |
[Question]
[
There are 3 (commonly used) trigonometric functions `sin` `cos` and `tan` each of these functions has an inverse function
You goal is to write 3 programs or functions (one for each inverse trigonometric function `asin` `acos` `atan`) that take a (real) number a input and return the result of the corr... |
[Question]
[
## Task
Given a finite permutation output its inverse.
You may take input and output in any reasonable format equivalent to a list of natural numbers. You may choose to use 0 indexing or 1 indexing. Your input and output format should be the same. You may assume a permutation has at least 1 element.
... |
[Question]
[
Given a non-negative integer, \$n\$, yield the \$(n^2)^\text{th } n\$-gonal number.
### Further Detail:
The \$x\$-gonal numbers, or *polygonal numbers*, are also known as the *two-dimensional figurate numbers*.
Many people will be familiar with the triangular numbers, these are the \$3\$-gonal number... |
[Question]
[
Write the shortest function that returns the content of the first result of a Google search ("I'm feeling lucky").
Example:
```
lucky('cat');
```
Might return something like:
```
<!DOCTYPE html>
<html>
<head>
<title>Cats are cool</title>
<meta charset="utf-8" />
</head>
<body>
<h1>C... |
[Question]
[
Given a word list, find all sets of five words of five letters each, such that the words of each set have 25 distinct letters in total.
This challenge was inspired by [this](https://www.youtube.com/watch?v=c33AZBnRHks&t=1424s) video by Matt Parker.
### Testcases
Use [this file](https://github.com/dwy... |
[Question]
[
Part of [**Advent of Code Golf 2021**](https://codegolf.meta.stackexchange.com/q/24068/78410) event. See the linked meta post for details.
Related to [AoC2020 Day 13](https://adventofcode.com/2020/day/13), Part 2.
[Why Bubbler isn't posting this](https://chat.stackexchange.com/transcript/message/5996... |
[Question]
[
[Steven Gerrard](https://en.wikipedia.org/wiki/Steven_Gerrard) was born on 30th of May 1980. He is now 37 years old. Happy birthday, Steven!
To celebrate his anniversary, your goal is to remind him the number of goals he has scored each year in premiere league for Liverpool.
He doesn't want to remem... |
[Question]
[
You will take two positive integers `n` and `x` as input, and output [Euler's totient function](https://en.wikipedia.org/wiki/Euler%27s_totient_function) (number of positive integers less than `x` co-prime to `x`) applied `n` times.
# Testcases
```
n x result
1 10 4
2 10 2
3 10 1
1 100 40
2 100 ... |
[Question]
[
Upon receiving month and year in YYYYMM format, generate output of the corresponding **calendar month** for that year.
For example the input `201312` should generate the following output:
```
Mo Tu We Th Fr Sa Su
1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 ... |
[Question]
[
# Input
A string of text.
# Output
The string of text, however, every consonant is the next consonant in the alphabet, and every vowel is the next vowel in the alphabet (z becomes b, u becomes a). The case of the new letter should be the same as the letter it is replacing (a becomes e, A becomes E). ... |
[Question]
[
Given a linear equation `mx+n`, return `n` and `m`. However, the equation may be in any of the following formats:
```
5x+2 -> 5 2
5x-2 -> 5 -2
5x -> 5 0
-2 -> 0 -2
x -> 1 0
```
Here are the formats, where each `?` stands for a positive integer written without leading zeroes
```
?x+?
?x-?
-?x+?... |
[Question]
[
**This question already has answers here**:
[Mathematical Combination](/questions/1744/mathematical-combination)
(36 answers)
Closed 7 years ago.
Given two nonnegative integers `n,k` such that `0 <= k <= n`, return the binomial coefficient
```
c(n,k) := (n!) / (k! * (n-k)!)
```
### Test cases... |
[Question]
[
**This question already has answers here**:
[Display number of occurrences for every character in an input string](/questions/19068/display-number-of-occurrences-for-every-character-in-an-input-string)
(66 answers)
Closed 7 years ago.
**GOAL :**
To Implement a character counting program
This... |
[Question]
[
Write a program which will take for input 2 integer arrays and return a truthy value if there exists an element which is present in both of arrays, or a falsy one otherwise. The obvious solution to this problem would be to iterate through each element in the first array and compare it against each el... |
[Question]
[
Recently there was [a question on Stack Overflow](https://stackoverflow.com/questions/31509311/return-the-first-word-with-the-greatest-number-of-repeated-letters) where the OP was trying to write a function to find the word in a string that has the most repeated letters. It is of course not hard to w... |
[Question]
[
Rosetta Stone Code Challenges are challenges where you must complete the task in as many languages as possible.
## The Challenge
You will be given two numbers, `n` and `s`, in a list as input. The `n` will be a number you have to count up to. `n` will be any number from 2 to 10000. `s` will be the nu... |
[Question]
[
In informatics, we often use trees in lots of different forms and representations. The three major methods of serialising binary trees are prefix, infix and postfix notation. For example, the following binary tree:
 *(source: Dutch Olympia... |
[Question]
[
Write a program to produce a file containing a crossword grid
that the user can print out and work the puzzle on.
## Input
A filename representing a crossword grid file and
optionally a second filename representing a crossword numbering
file. The input should be accepted by a conventional means for
... |
[Question]
[
"Buzzing" Bill is a well respected beaver. He is the hardest working in his home dam. He was a strong beaver and was able to lift more logs than anyone at the dam. Unfortunately Buzzing Bill's career came to an end in a tragic accident. Being such a prominent figure in his town, the Beaver newspaper ... |
[Question]
[
## Introduction
Ah, INTERCAL...
As much as I'd like encourage everyone to [Try it Online](https://tio.run/#Intercal), text output is just painful.
According to the [docs](http://www.muppetlabs.com/%7Ebreadbox/intercal-man/home.html) it uses the "Turing Text Model".
While an... *interesting* conce... |
[Question]
[
*The New York Times* periodically runs a puzzle they call the "Spelling Bee" in which they list six "allowed" letters plus one "mandatory" letter and challenge the reader to form as many five-letter-or-longer dictionary words as possible out of those letters. Each "allowed" letter can appear 0 or mor... |
[Question]
[
## Input
A dictionary with string keys and string values.
## Output
The 'inversedict' of this dictionary.
## How to make an inversedict
An inversedict is a dictionary with string keys and **string array** values. The keys are the values from the original dictionary, and the values are the keys from... |
[Question]
[
## Challenge
You must write an encoder (and a separate decoder) which takes a string as input and outputs the string encoded in the *style* of a strand of DNA.
## DNA
DNA is made up of four types of nucleotide:
* Adenine (A)
* Thymine (T)
* Cytosine (C)
* Guanine (G)
Adenine and thymine pair up toget... |
[Question]
[
## Challenge
Write the shortest program P such that
* P takes any positive integer n as input, and outputs a program string P1
* executing P1 (with no input) outputs a program string P2,
* executing P2 (with no input) outputs a program string P3,
* ...
* executing Pn (with no input) outputs exactly ... |
[Question]
[
The Lost Numbers are 4, 8, 15, 16, 23, 42. Your goal is to create an expression to output them all.
Your allowed characters are 0123456789, ^+-\*/, (), % for modulo and n as the single variable allowed. Modified PEMDAS `()^*/%+-` is the precedence and / is normal division (3/2 = 1.5). 0^0 = 1 althoug... |
[Question]
[
## Background
In C, there is a function to help parse command-line arguments: `getopt`.
Getopt takes the argument count (`argc`), the argument list (`argv`), and a string representing the options the program should take (**`optstring`**).
The option string (`optstring`) is a series of option characte... |
[Question]
[
## The Challenge
Write a program that takes an integer *N* as input, and outputs the stage of life or death that a tree is currently in. *N* will always be between 0 and 10.
**The Stages of Life and Death**
* **Life:** To draw a stage of life, simply draw a base of size *N*, consisting of `^` charact... |
[Question]
[
The Rugby World Cup starts in a few hours!
Write a program or function which, given a rugby team score as input, outputs all possible ways the score could have been attained in a Rugby game.
### Ways to score in Rugby
* **Penalty kick/Drop kick:** Both penalty kicks and a drop kicks are worth **3** p... |
[Question]
[
# **Prelude:**
This task is taken from [Five Problems Every Software Engineer Should Be Able to Solve in Less Than an Hour](https://gist.github.com/agrison/1a27a50c22a7f46df17c), which I really recommend.
# **The task:**
>
> Write a program that outputs all possibilities to put + or - or
> nothing b... |
[Question]
[
When you run your program first, it should print an integer sequence. The
second run should print the 'Mary had a little lamb' song. The third run should
produce an ASCII image file.
## Scoring
Your score will be the sum of your bytes of code and any file content at the
start of each of the 3 runs. L... |
[Question]
[
*This challenge was originally [posted on codidact](https://codegolf.codidact.com/posts/289152).*
---
At my job we have to sometimes lay out materials. Materials come in large long rolls and are cut into smaller pieces when being laid out.
When we order the rolls we draw up a layout document which de... |
[Question]
[
**Input:**
Ten unique integer coordinates, between `(0,0)` and `(100,100)`.
**Output:**
The coordinates arranged in the order/an order such that a path drawn between the coordinates in that order is the shortest path possible.
This is code golf so the shortest code wins!
[Answer]
# [Wolfram La... |
[Question]
[
~~Write a program that outputs the number 0.~~
That's a bit trivial, isn't it?
Let the length of your program be \$S\$. Write a program that outputs the number 0. When your program is cyclically shifted \$i < S\$ bytes left, it should output \$i\$. To cyclically shift a string \$i\$ bytes left means ... |
[Question]
[
The [Dihedral group \$D\_3\$](https://en.wikipedia.org/wiki/Dihedral_group_of_order_6) represents the symmetries of an equilateral triangle, using the identity (represented by `id`), rotations (represented by `r1` and `r2`), and reflections (represented by `s0`, `s1`, and `s2`).
Your task is to comp... |
[Question]
[
According to [this question](https://codegolf.stackexchange.com/questions/166999/execute-a-superb-shuffle) a Superb Shuffle™️ is defined as a full deck of cards (including jokers) which follows this set of rules:
* No two cards (except Jokers) of the same suit are adjacent.
* No card (except Jokers) ... |
[Question]
[
The day of the week and month of the year seem to get a lot of attention but no one seems to care about the week of the year. I believe it's time to change that, so your job is to write a program or function that when given a date outputs an integer between 1 and 53 corresponding to the current week ... |
Subsets and Splits
Python Q&A Count
Counts the number of questions and answers related to Python in the dataset, providing insight into the prevalence of Python content.