All Questions
4
votes
0answers
104 views
A simple number system
Let me tell you about a simple number system. (which I made up just for this challenge)
This system contains the functions (), [], {}, and <>.
1. ()
When () is given no arguments, it ...
5
votes
4answers
90 views
Find the “Recursive Size” of a List
Inspired by Find the “unwrapped size” of a list.
Define the Recursive Size, RS, of a list containing no lists as it's length (number of items contained) and the Recursive Size of a list containing ...
2
votes
3answers
48 views
Animate finding the middle
Given a non-empty string, keep removing the first and last characters until you get to one or two characters.
For example, if the string was abcde, your program should print:
abcde
bcd
c
However,...
8
votes
2answers
242 views
Draw the Sierpinski Arrowhead Curve
Introduction
The Sierpinski Arrowhead Curve is a curve that's limit is Sierpinski's Triangle.
It first starts like this:
_
/ \
Then, each line is replaced with a rotated version of the first one:
...
10
votes
9answers
408 views
PPCG Jeopardy: Robbers
How well do you know the site? Let's find out.
This is a cops-and-robbers challenge. Cop's thread.
As a robber, you need to:
Find a non-deleted, non-closed challenge that matches a cop's ...
27
votes
20answers
595 views
PPCG Jeopardy: Cops
How well do you know the site? Let's find out.
This is a cops-and-robbers challenge. Robber's thread.
As a cop, you need to:
Find a non-deleted, non-closed challenge on this site to answer. The ...
0
votes
0answers
35 views
Draw the Serpinski Triangle [duplicate]
For today's fractal challenge, draw at least 5 iterations of Sierpinski's triangle! (Shown below is Sierpinski's trinagle)
The resolution of the image must be sufficent that the smallest triangles ...
5
votes
4answers
435 views
Draw the Hilbert Curve
A hilbert curve is a type of space-filling curve, and it basically maps a line to a plane. Each point in the line corresponds to just one point in the plane, and each point in the plane corresponds to ...
20
votes
4answers
783 views
I really wanted a rhombus, but all I got was this stupid rectangle
Given only a straightedge and compass, inscribe a rhombus inside the given rectangle, sharing two opposite points.
Input
Input is the dimensions of the rectangle. In the example shown, that would be ...
-2
votes
0answers
59 views
Opacity from RGB array [on hold]
So I'm no expert in coding: I just have a vague understanding of a few bits and bobs.
I understand that images of pixel dimensions X*Y are stored in array of size 3*X*Y where each vector pulled from ...
19
votes
14answers
1k views
Is it a stochastic matrix?
A stochastic matrix is a matrix of probabilities used in the context of Markov chains.
A right stochastic matrix is a matrix where each row sums to 1.
A left stochastic matrix is a matrix where each ...
-5
votes
5answers
125 views
Your Search Returned No Results [on hold]
Your task is simple. Write a program (or function) whose output returns no search results on google.
Rules:
It must take no input.
It must not cause an error.
It must terminate.
It must produce the ...
4
votes
11answers
167 views
Make an inversedict
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 ...
-1
votes
0answers
39 views
Polylingual code [duplicate]
I saw the following in Jon Skeet Facts:
Jon Skeet can code in Perl and make it look like Java.
That inspired the following challenge:
Create a "Hello, World!" program that compiles and runs ...
7
votes
13answers
978 views
Do Matrix Multiplication!
In mathematics, matrix multiplication or the matrix product is a binary operation that produces a matrix from two matrices. The definition is motivated by linear equations and linear transformations ...
15
votes
5answers
720 views
Sample a random non-decreasing sequence
Input: Two integers n and k given in any form that is convenient for your code
Output A random non-decreasing sequence of k integers, each in the range 1 to n. The sample should be chosen uniformly ...
20
votes
2answers
436 views
On this site we obey the laws of thermodynamics!
And in particular the second law: the entropy of an isolated system increases over time.
For this challenge,
An "isolated system" will be taken to be a program or function (abbreviated as "program" ...
24
votes
18answers
3k views
Head, Shoulders, Knees and Toes, Knees and Toes
Introduction:
I think we all know it, and it has probably been translated in loads of different languages: the "Head, Shoulders, Knees and Toes" children song:
Head, shoulders, knees and toes, ...
29
votes
17answers
2k views
Finding The nth Prime such that the prime - 1 is divisible by n
Problem
The goal is as the title says to find the nth prime such that the prime - 1 is divisible by n.
Explanation
Here is an example so you understand the question, this is not necessarily the ...
0
votes
0answers
106 views
“I am Lord [name]” anagram generator [on hold]
In Harry Potter and the Chamber of Secrets we see that
Tom Marvolo Riddle
is an anagram for I am Lord Voldemort.
Task
Write a function that the user can pass 2 string arguments to as inputs: the ...
30
votes
31answers
2k views
Goodness Giza Golf!
A "Giza number", also colloquially known as a Timmy Number is any number where the digits represent a pyramid (A134810). For example, "12321" is a giza number because it can be visualized like this:
...
19
votes
6answers
1k views
Magic mirror madness
Introduction
I have a room full of magic mirrors.
They are mysterious artifacts that can duplicate any item, except another magic mirror.
More explicitly, a duplicate version of the item will appear ...
5
votes
1answer
175 views
Check if rectangles fill a rectangular space without gaps or overlaps
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 ...
6
votes
3answers
201 views
My Pet Peeve Challenge
There's something (well, many things 😀) that really annoys me. It is when dictionaries (English, not Pythonic) use the defining word itself to define the word, also called circular definitions. ...
22
votes
23answers
2k views
Alphabetically permute a string
Task
Your goal, should you choose to accept it, is to write a program, that, given an input string (or array of characters), outputs every possible permutation of the letters in that string. I'm ...
6
votes
5answers
332 views
Build me a brick road! [duplicate]
I need help making a brick road to go beside my brick wall!
\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \
\__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \__\ \...
22
votes
3answers
418 views
Choose the last card in a poker hand
Poker hands are ranked from best to worst as follows:
Straight flush - five cards of sequential rank, all of the same suit
Four of a kind - four cards of the same rank and one card of another rank
...
5
votes
1answer
136 views
Create Fluffy Blocks
(randomly inspired by this question)
Let's make a drawing from some pipes | and hyphens -. Choosing a subset, if chosen carefully, you can form a rectangular box or block shape (meaning that the ...
0
votes
8answers
374 views
Helicopter challenge
There is a helicopter flying 500 meters from the ground. It can fly up 100 meters, which takes 1.0 secs. Or if it doesn't fly up it will fall 200 meters, which also takes 1.0 secs - This means if the ...
0
votes
0answers
57 views
French Conjugation code [duplicate]
If you've ever studied a language you will know what conjugation is.
It is a verb changing form because of a pronoun an example in english is "I run" and "He runs". We will be doing french ...
63
votes
36answers
4k views
5 Favorite Letters
The challenge is actually extremely simple. Pick 5 distinct letters (you can just pick the 5 that allow you the shortest code if you like) and output them to the console. However, the twist is that ...
27
votes
13answers
3k views
North by North by North by South East
Given a string of N, S, E and W, output a bearing (angle clockwise from North in degrees), correct to 5 decimal places.
In traditional compass notation, a string is made up of only 2 of these ...
6
votes
0answers
93 views
Play Best Card in Euchre
Input:
Firstly
An array of three cards representing the cards played by each player formatted like
[JD][TH][9S]
Representing
Jack of Diamonds, 10 of Hearts, and Nine of Spades.
As you always sit ...
-2
votes
0answers
58 views
Multiplication Fibonacci [duplicate]
The Multiplication Fibonacci sequence starts with 1 and 2, then each term is the product of the last two terms:
Fn = Fn-1 × Fn-2; F1 = 1; F2 = 2
The sequence starts out like this:
1
2
2
4
8
32
...
-2
votes
0answers
36 views
Validating a Date in python [on hold]
I'm trying to write a code for Validating a Date in python I have two question
1_ why I can't use this form 01/05/2015, it keep give me an error
2_ how I can't stop the user use the negative ...
-2
votes
0answers
78 views
Green but no Red [on hold]
Goal: print the word "Red" using all the letters in the word "Green" that are not in the word "Red."
Reserved words do not apply, and do not count towards spelling "green" or spelling "red." You can ...
44
votes
63answers
8k views
Do n and n^3 have the same set of digits?
Given a number n (0 <= n <= 2642245), check if n and n3 have the same set of digits, and output a truthy or falsey value accordingly.
For example, let's check the number 100.
1003 is 1000000.
...
0
votes
0answers
62 views
String Addition (Adding a Maximum of 9+9+9) [duplicate]
The Challenge
You must create a program that does addition using string manipulation, similar to:
999
+ 1
----
1000
Which means the maximum amount of addition possible is 9+9+9. And your code ...
21
votes
7answers
518 views
Smallest number of contiguous monotonic subsequences
Challenge description
A monotonic subsequence is a sequence of numbers [a1, a2, ..., an] such that
a1 <= a2 <= ... <= an or a1 >= a2 >= ... >= an. [1, 3, 3, 7, 9, 13, 13, 100] is a ...
19
votes
20answers
2k views
The Art of Word Shaping
The Art of Word Shaping
Given a binary matrix, and a string of letters, replace all 1's in the matrix from left, to right with the letters of the string. Once the letters have been formed into the ...
25
votes
4answers
486 views
Battle of the Fellowships KotH
In this challenge, you are going to create a Fellowship with the goal of defeating all other fellowships in battle.
A fellowship (team) consists of 3 characters. Each character moves independently ...
16
votes
5answers
253 views
Walk the words!
It is in my humble opinion that standard text is boring. Therefore I propose a new writing standard, walking words!
Walking words
Walking words are words which will respond to certain characters. ...
7
votes
2answers
384 views
Manoeuvre the grid!
Briefing:
You are a bot, in a 2D grid that extends infinitely in all four directions, north, south, east and west. When given a number, you must move the bot so that you get to the target number.
...
20
votes
12answers
2k views
Score a hand of Hearts
Hearts is a trick-taking card game for 4 players. Each trick is taken by the player who played the highest card of the leading suit. At the end of each hand, the players incur a penalty score ...
-6
votes
0answers
58 views
implementation of linked list [closed]
Note that there are actually two lists in the array.The data list strats at element 2 and progresses through 6 and 0 and to the end of the data at element 9.The second list links all of the empty or ...
14
votes
2answers
1k views
Golfing Flower of Life
The challenge here is to accurately depict the flower of life (which is a sacred geometrical figure according to some) in the language of your choice.
The design consists an arrangement of circles ...
6
votes
0answers
113 views
Out Steganograph Me! [duplicate]
Out Steganograph Me
As a follow up to this challange, I want to see competitive algorithms for encoding strings as images, and then decoding them.
The Challenge
Your goal is to write a function or ...
15
votes
2answers
315 views
Downgoat-ify Animals!
My Downgoat avatar has several distinct features
These features can however also apply to any other animal.
Specification
Given an image of an animal (technically can be anything), you must apply ...
1
vote
0answers
125 views
How Big is the Hyperbolic Round Table of Camelot? [on hold]
There is a hyperbolic rogue-like game called HyperRogue, based on the truncated order-7 triangular tiling. (Each vertex is surrounded by two hexagons and one heptagon.) There is a place in this game ...
-6
votes
0answers
57 views
Tell me my WPM! [closed]
Given a string of text typed, and the number of seconds it took to type, find the WPM.
For the purposes of this challenge, assume that a word is five characters.
You may round the output to the ...