text
stringlengths
26
126k
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] []
[Question] [ ## 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 to do this within *reasonable* definitions of "a single command", I thought it might be a fun proble...
[Question] [ *Inspired by [this Stack Overflow question](https://stackoverflow.com/q/52657041/2586922)*. ## The challenge ### Input An array of square matrices containing non-negative integers. ### Output A square matrix built from the input matrices as follows. Let \$N \times N\$ be the size of each input matrix...
[Question] [ ## 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 to do this within *reasonable* definitions of "a single command", I thought it might be a fun proble...
[Question] [ # Supreme Sum String Given an input string, return the word with the highest sum of each of its unicode characters. ## Rules * The input should be seperated by whitespace * The value of each word is based on the sum of each character in the word's UTF-16 code * The output should be the first word wi...
[Question] [ Letters of the words want fairness. They decided to appear same number of times in a sentence equally. Example: ``` Priorities ``` Will become: ``` Ppprrioooritttieeesss ``` Each letter appears 3 times, as the most common letter was `i`, appearing 3 times. It does not matter where you put the repeate...
[Question] [ Using the word “conemon” print each character 2 times more than the last. The first letter, “c”, should be printed 10 times, the second 12 and so on. Each repeated-letter-string should be printed on a new line. So the end-result becomes: ``` cccccccccc oooooooooooo nnnnnnnnnnnnnn eeeeeeeeeeeeeeee mmm...
[Question] [ # Challenge You are given an array \$a\$ of integers. With a ***move*** you can **increase or decrease** an element of the array **by 1**. Your task is to ***equalize*** the array, that is make all the elements of the array equal by performing some *moves*. But that's not enough! You also want to mak...
[Question] []
[Question] [ **Challenge:** The concept is simple enough: write a full program to output its own code golf score! Output should only be the byte count of your program and a trailing `bytes`. **BUT WAIT**..... there is one restriction: * Your source code can not include any of the digits from your byte count * So...
[Question] [ ## Challenge We take three positive integers `a`, `b`, and `c` as input. Using these integers, first create a sequence in the range `[0, c]` (inclusive on both ends), in steps of `b`. For example, for `a=4, b=2, c=100`, the sequence would be `[0,2,4,...,96,98,100]`. For every number in this sequence ...
[Question] [ We all know of different fancy sorting algorithms, but none of these give us numbers in a way that's easy to pronounce. To remedy this, I propose using PronunciationSort™, the most natural way to sort lists of numbers. ## Pronunciation The official rules for pronouncing numbers (in this challenge) is...
[Question] [ Given a word, treat every letter as its number in English alphabet (so `a` becomes 1, `b` becomes 2, `z` becomes 26 and so on), and check if all of them, including duplicates, are pairwise [coprime](https://en.wikipedia.org/wiki/Coprime_integers). The input is exactly one word of lowercase English le...
[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 5 years ago. [Improve this que...
[Question] [ You will be given 3 integers as input. The inputs may or may not be different from each other. You have to output 1 if all three inputs are different from each other, and 0 if any input is repeated more than once. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'...
[Question] [ # Challenge Your task is to encode an integer as a string of [ASCII](https://codegolf.meta.stackexchange.com/a/5869/82619) characters, then successfully decode it after said string has been randomly shuffled. You will write two [programs/functions](https://codegolf.meta.stackexchange.com/q/2419/82619...
[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/172511/edit). Closed 5 years ago. [Improve this question](/posts/172511/edi...
[Question] [ As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by "golfing" it! So it goes simply like that: > > Without using numbers, write a code that outputs the annua...
[Question] [ The program should take input the number, the start of the range and the end of the range, and output how many integers the number appears between the start and end of the range, **inclusive**. Both programs and functions are allowed. ## Example Inputs For example: ``` //Input example 1 3,1,100 //Inp...
[Question] [ ## Introduction: I think everyone knows what a Lava Lamp is, but in case they do not: [![enter image description here](https://i.stack.imgur.com/dILgU.gif)](https://i.stack.imgur.com/dILgU.gif) [(Image source)](http://api.ning.com/files/qrbliHRnvdw1Rjlr3hjMBmZV8cArQzQHkjqIHMFYV8KWdSCn2lBsAOS6i8s6Tl...
[Question] [ A shape is [chiral](https://en.wikipedia.org/wiki/Chirality) if no amount of rotation can make it look like it's mirror image. In this puzzle we will be writing chiral computer programs. For this puzzle we will think of a program as a rectangular matrix of characters. As such all solutions to this ch...
[Question] [ ## Introduction: I think everyone knows what a Lava Lamp is, but in case they do not: [![enter image description here](https://i.stack.imgur.com/dILgU.gif)](https://i.stack.imgur.com/dILgU.gif) [(Image source)](http://api.ning.com/files/qrbliHRnvdw1Rjlr3hjMBmZV8cArQzQHkjqIHMFYV8KWdSCn2lBsAOS6i8s6Tl...
[Question] [ **Challenge** Giving a valid arithmetic sum with some missing numbers, output the full expression. Example: ``` 1#3 123 + 45# => + 456 -------- -------- 579 579 ``` **Input** * Expression format can be an array `["1#3", "45#", "579"]`, ...
[Question] [ I'm looking for tips for golfing in the R statistical language. R is perhaps an unconventional choice for Golf. However, it does certain things very compactly (sequences, randomness, vectors, and lists), many of the built-in functions have [very short names](https://stackoverflow.com/questions/697963...
[Question] [ ## Definition Given a matrix \$M\$ of non-negative integers and a non-negative integer \$k\$, we define \$F\_k\$ as the "chop-off" function that removes all rows and all columns in \$M\$ that contain \$k\$. *Example:* $$\begin{align}M=\pmatrix{\color{red}6&\color{red}1&\color{white}{\bbox[red,1pt]{5}...
[Question] [ A [*nondeterministic finite automaton*](https://en.wikipedia.org/wiki/Nondeterministic_finite_automaton) is a finite state machine where a tuple \$(state,symbol)\$ is mapped to multiple states. Ie. we replace the usual \$\delta : Q \times \Sigma \to Q\ \$ transition function of a [DFA](https://en.wik...
[Question] [ ## Introduction: Inspired by [this comment of *@MagicOctopusUrn*](https://codegolf.stackexchange.com/questions/129523/it-was-just-a-bug#comment326309_129549) on [*@Emigna*'s 05AB1E answer](https://codegolf.stackexchange.com/a/129549/52210) for my ["*It was just a bug*" challenge](https://codegolf.sta...
[Question] [ You will be given 3 integers as input. The inputs may or may not be different from each other. You have to output 1 if all three inputs are different from each other, and 0 if any input is repeated more than once. This is [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'...
[Question] [ ## Challenge For a given positive integer \$n\$: 1. Repeat the following until \$n < 10\$ (until \$n\$ contains one digit). 2. Extract the last digit. 3. If the extracted digit is even (including 0) multiply the rest of the integer by \$2\$ and add \$1\$ ( \$2n+1\$ ). Then go back to `step 1` else mo...
[Question] [ As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by "golfing" it! So it goes simply like that: > > Without using numbers, write a code that outputs the annua...
[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] [ Given an integer greater than 1, output the number of ways it can be expressed as the sum of one or more consecutive primes. Order of summands doesn't matter. A sum can consist of a single number (so the output for any prime will be at least 1.) This is [code-golf](/questions/tagged/code-golf "show ...
[Question] [ I was trying to find the shortest code possible that given a number n, returns the next prime palindrome number (limited to below 100000). If the number itself is a prime palindrome, the code should return the next one. Write the shortest program/function that, when given an input `n` (less than `100...
[Question] [ # Introduction In number theory, a number is considered evil if there are an even number of 1's in its binary representation. In today's challenge, you will be identifying whether or not a given number is evil. # Challenge Your job is to write a full program or function which accepts a single, non-ne...
[Question] [ While moving, I broke my lamp. Now, I need a new one. It's your job to make me a lamp! I'm not sure what size I want, though I know I want a squiggly one. Your program/function must take in a number input, and print out a lamp with that many squiggles/bumps. **Examples:** Input:`2` Output: ``` /--\ ...
[Question] [ I can't believe we don't have this already.. It's one of the most important data-structures in programming, yet still simple enough to implement it in a [code-golf](/questions/tagged/code-golf "show questions tagged 'code-golf'"): ## Challenge Your task is to implement a stack that allows pushing and...
[Question] [ Most tip calculator apps simply take a flat percentage of the meal price. So, for example, if your meal is $23.45, you can leave a 15% tip = $3.52, or a more generous 20% tip = $4.69. Convenient enough for credit card users. But not so if you prefer to leave cash tips, in which case these oddball cen...
[Question] [ ## Introduction Today's challenge is all about teeth. Specifically, how long it takes to brush from one tooth to another. Your challenge is, given the locations of two teeth, output the shortest amount of time possible to brush from the first to the second. ## Challenge For this challenge we will be ...
[Question] [ In Russia we have something like a tradition: we like to look for lucky tickets. Here's what a regular ticket looks like: [![bus ticket](https://i.stack.imgur.com/0bqM1m.jpg)](https://i.stack.imgur.com/0bqM1m.jpg) As you can see, the ticket has a six-digit number. A six-digit number is considered **...
[Question] [ Create a function, expression, or program which does the following: 1. Take the prime factors of any number and sum them. For example, the prime factors of 28 are 2 2 7, summed to 11. 2. Multiply the result by the number of prime factors for the given number. E.g, 28 has 3 prime factors which sum to ...
[Question] [ ### Kids-related intro Whenever I take my kids to an amusement park, the kids get more nervous the closer we are to the park, with the nerve peak when we are in the parking lot and find no place to park. So I've decided I need a method to find the closest free parking space to minimise the time spent...
[Question] [ # Introduction A while ago a lost SO user posted a question here and its now been deleted but I think it would make a good challenge so here it goes... # Challenge Write a full program or function that takes two strings and checks whether any permutation of the first string is a sub-string of the sec...