All Questions

Filter by
Sorted by
Tagged with
-2
votes
2answers
122 views

Generating all Character possibilities with two characters [duplicate]

Introduction So the Challenge is to give out all combinations with two Inputs. The length of the string is also optional and you should be able to edit this. I've selected this channel because I ...
37
votes
31answers
14k views

Do the 26 richest billionaires own as much wealth as the poorest 3.8 billion people?

Introduction: A few days ago I read this post with the same title when I came across it in the HNQ. In this question it is being discussed if the claim of president-candidate Bernie Sanders, who ...
-2
votes
6answers
191 views

Add 2 positive integers by playing with bits [closed]

Given 2 positive integers in any format you'd like, return their sum using only logic gates and bit shifts (see example below). Don't worry about overflow. EDIT: Using pre-written addition is ...
11
votes
7answers
4k views

Find the closest HTML colour name

Input A single hex 6-digit colour code, capital letter, without #. Can also be a 24-bit integer if you prefer. Output The closest HTML color name (e.g ...
23
votes
23answers
2k views

Find the closest three-digit hex colour

In CSS, colours can be specified by a "hex triplet" - a three byte (six digit) hexadecimal number where each byte represents the red, green, or blue components of the colour. For instance, ...
5
votes
2answers
292 views

Golf my iteration function

Here is my ungolfed Ruby code for a function I want to try and golf: ...
12
votes
3answers
466 views

Implement a strongly Darboux function

According to Wikipedia, a strongly Darboux function is one for which the image of every (non-empty) open interval is the whole real line In other words, a function \$f\$ is strongly Darboux if ...
29
votes
17answers
3k views

A quine of sorts

Given a string x, output the characters in x sorted according to the order of appearance in your source code. Examples ...
24
votes
13answers
4k views

Two palindromes are not enough

Some numbers, such as \$14241\$, are palindromes in base 10: if you write the digits in reverse order, you get the same number. Some numbers are the sum of 2 palindromes; for example, \$110=88+22\$, ...
-5
votes
1answer
339 views

Write the shortest O(n^2) sorting algorithm [closed]

Write a sorting algorithm for a list of integers that has an average performance of O(n^2). This is code-golf, so the shortest code in bytes wins. RULES: The characters wasted for the declaration ...
43
votes
12answers
3k views

Prime parity peregrination

The purpose of this challenge is to graphically depict a walk on the plane, where the direction of each step \$k\$ is determined by the primality of \$k\$ and the parity of its binary expansion. ...
29
votes
7answers
7k views

Golf the smallest circle!

The problem: Given a non-empty set of points in the Cartesian plane, find the smallest circle that encloses them all (Wikipedia link). This problem is trivial if the number of points is three or ...
7
votes
5answers
632 views

Output the nth 'boring' number

There are 9 main types of numbers, if you categorise them by the properties of their factors. Many numbers fall into at least one of these categories, but a few don't. The categories are as follows: ...
5
votes
1answer
141 views

Letter Boxed, part 2: this time, solve it

This challenge is a sequel to Letter Boxed Validator. The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a ...
6
votes
6answers
258 views

Inverse-quotes-quine, inverted (pt. 2)

Based on a comment by Jo King on my previous question (called 'Inverse-quotes-quine'), I present this new question. The rules are similar, but just, the opposite: If your program is run normally, all ...
23
votes
19answers
3k views

Analog is Obtuse!

An analog clock has 2 hands*: Hour and minute. These hands circle the clock's face as time goes by. Each full rotation of the minute hand results in 1/12th of a rotation of the hour hand. 2 full ...
3
votes
5answers
457 views

Number conversion

Assume that there is a number a. In every conversion of that number, the number can either convert itself to its value plus the value of one of its digits, or ...
32
votes
47answers
4k views

Alphabet completion rate

Introduction How much of the English alphabet does a given string use? The previous sentence uses 77%. It has 20 unique letters (howmucftenglisapbdvr), and 20/26 ≃ 0.77. Challenge For an input ...
29
votes
18answers
2k views

Inverse-quotes-quine

The prospect of this challenge is: If your program is run normally, all of the code in the speech marks (" - double quotes) should be printed. If your program is ...
5
votes
0answers
166 views

Fastest way to iterate over sublattice of discrete lattice

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 ...
16
votes
13answers
3k views

Is my Rep in Stack-Exchange Form?

Premise: Your reputation is in Stack-Exchange Form if it can be represented by decomposing your medal counts (gold, silver, and bronze counted separately) into their base-10 digits and joining them ...
12
votes
7answers
842 views

Find the diameter of a word graph

Introduction A popular word puzzle is to convert one word into another via a series of steps which replace only one letter and which always result in a valid word. For example, BAG can be converted ...
39
votes
21answers
6k views

Impossible darts scores

I was surprised to not find this asked already, though there is a great question on darts checkouts: Darts meets Codegolf Your challenge is to calculate which scores are not possible with 'n' darts ...
6
votes
1answer
230 views

Convert a string containing integers to list of integers

What is the shortest way to convert a string containing integers separated by spaces to a list of integers? input : "-3 1 5 8 10" output : [-3, 1, 5, 8, 10] I regularly face this situation and I ...
10
votes
22answers
2k views

Find the C-factor of a vote

In this challenge you will be determining how controversial a vote is, given an array of other votes, by figuring out a number called the C-factor. What is the C-factor, you ask? Well, imagine you've ...
13
votes
4answers
435 views

Distributing parliament seats

Introduction In a general election, one would like to calculate a constant price per parliament seat. This means that for N >= 0 seats to be distributed and a ...
11
votes
29answers
5k views

Count All Possible Unique Combinations of Letters in a Word

You are given a string, which will contain ordinary a-z characters. (You can assume this will always be the case in any test, and assume that all letters will be lowercase as well). You must ...
21
votes
6answers
974 views

Subtract the Folded Matrix

Challenge: Given an NxN matrix where \$N\geq2\$ and one of eight distinct 'folding options', output a 2D array/list with the subtracted values. The eight folding options are: left-to-right; right-to-...
33
votes
8answers
6k views

Cut the gold chain

A traveler needs to stay for n days in a hotel outside town. He is out of cash and his credit card is expired. But he has a gold chain with n links. The rule in this hotel is that residents should ...
12
votes
7answers
382 views

Print the total length of all “quoted” characters

Rules In this challenge, I'm going to redefine the definition of "quotes" a bit. Quotation marks (AKA quotes) are any identical characters used in pairs in various writing systems to set off direct ...
11
votes
3answers
2k views

Print 'A' 1000 times with BrainFuck

What is the best BrainFuck code (in terms of code size) to print 'A' 1000 times ? My approach is: set 'A' to p[0] set 255 to p[1] to display 255 'A', 3 times set 235 to p[1] to display 235 'A' This ...
8
votes
2answers
187 views

Reroute the Path

Given a grid of directions and a start and end position, determine the minimum number of substitutions in the direction grid that needs to be made to complete the path between the two points. The grid ...
29
votes
4answers
2k views

Print the new site header

The new site header has some bits of source code from various questions as the background. Here are the first 3 lines: ...
21
votes
8answers
1k views

Fill the maze with a wall-following Snake until it gets stuck

Make a snake fill any maze (until it gets stuck). The snake The snake starts at a given starting point, pointing EAST. It moves by always having a wall or a part of its body immediately to the LEFT ...
17
votes
31answers
3k views

First occurrence in the Sixers sequence

The Sixers sequence is a name that can be given to sequence A087409. I learned about this sequence in a Numberphile video, and it can be constructed as follows: First, take the multiples of 6, ...
-3
votes
1answer
132 views

Pandemic Outbreak Calculator [closed]

In the board game Pandemic, an outbreak occurs when a city contains more than 3 disease cubes. When the outbreak occurs, any disease cubes in the city in excess of 3 are removed, and each city ...
-2
votes
14answers
440 views

FizzBuzz but time-based

Make a program that outputs the number of seconds from the beginning of today (00:00:00 of the day you run it) to the second you ran it. However, if this number is divisible by three, print ...
-7
votes
10answers
211 views

The year counter is here [closed]

Create a program that, given an integer N, outputs the number of years we have to get to N A.D. or how many years it has been since N A.D, as a string or int. For example, given 2014, the program ...
8
votes
1answer
269 views

Partition and Restructure

Given two contiguous shapes of the same area, determine the optimal way to divide the first shape into a minimum number of contiguous segments such that they can be rearranged to form the second shape....
3
votes
15answers
577 views

The anti-narcissist

The narcissist is a program which, given its own source as input, prints a truthy value and, given anything other than that, prints a falsey value. Today, we're reversing this. Create a program that, ...
49
votes
29answers
10k views

Print the phrase “And she said, 'But that's his.'” using only the alphabet

Print the phrase And she said, 'But that's his.' using only the following characters: ...
57
votes
11answers
8k views

New Site Design!

Unless you have a userscript that modifies the site's design (or even if so), you should have noticed that we have our site design! (It's November now) So, to celebrate, let's make a program that ...
12
votes
2answers
396 views

Who can escape the Nonary Game?

The Nonary Game is a fictional game played in the video game trilogy of the same name. Your goal is to find how many players (at best) can escape a given game, in as few bytes of code as possible. ...
41
votes
29answers
5k views

Nth term of Van Eck Sequence

Output the Nth term of the Van Eck Sequence. Van Eck Sequence is defined as: Starts with 0. If the last term is the first occurrence of that term the next term is 0. If the last term has occurred ...
10
votes
21answers
957 views

An OEIS polyglot

This is an answer-chaining challenge relating to the OEIS. Oh, the justification for this is because a company needs one program to print out their OEIS sequences real bad and they have every ...
0
votes
2answers
196 views

Alphabet without the alphabet [duplicate]

You are tasked with displaying the string "ABCDEFGHIJKLMNOPQRSTUVWXYZ" and only that, except for trailing newlines if they're unavoidable. You must not output any homoglyphic characters like Cyrillic ...
55
votes
10answers
5k views

Parsing text written the millitext font

Reading the text of the millitext font There is a font here that fits each character into a single, 1x5 pixel block. It does this (assuming you're using an LCD screen) by using the RGB channels of ...
5
votes
2answers
248 views

Generate Aheui Number

Make a Number Expression is related : actually, it is also about Aheui. But it just made number expression, but this made real Aheui code. Aheui is esolang written in only Korean character. Because ...
45
votes
45answers
13k views

Print “N NE E SE S SW W NW”

This seems almost trivial, but since after some effort I was not able to beat the literal solution in J, I thought it might make a decent challenge (though, to be clear, this is not a J-specific ...
17
votes
17answers
4k views

That's not my X, its Y is too Z

This challenge is inspired by a series of young children's books by Fiona Watt and Rachel Wells, which I've recently been enjoying with my daughter. In each book a mouse (illustrated, but not part ...

15 30 50 per page