instruction stringlengths 34 53.1k |
|---|
Challenge
Given a plot with broken paths, return the plot with all paths connected in the minimum number of changes.
Explanation
This problem deals with graphs on the Cartesian plane. Every node has 8 possible edges, extending vertically, horizontally, or diagonally. Each direction is represented by a number 0-7 as fol... |
What general tips do you have for golfing in Mini-Flak? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Mini-Flak (e.g. "remove comments" is not an answer).
Please post one tip per answer.
Mini-Flak is just Brain-flak without [], <...> or <> so tips for ... |
Introduction
Unlike English, German is considered to have quite a phonemic writing system. That means that the correspondence between spelling and pronunciation is close. Given any word you aren't familiar with, you would still know how to pronounce it because of the spelling system. This means a computer should be abl... |
Task:
Given sample index, x, calculate sample value f(x) of triangular wave, with period of 4 samples and amplitude 1. Offset can be negative and sample value could be either {0, 1, -1}.
Test cases:
-5 -> -1
-4 -> 0
-3 -> 1
-2 -> 0
-1 -> -1
0 -> 0
1 -> 1
2 -> 0
3 -> -1
4 -> 0
5 ->... |
Given two numbers, print a page with an "X" in the specified location (±10%).
The numbers must be either percentages or fractions of the page's print area dimensions, e.g. [25,75] or ["15%","0%"] or [0.33,1]. You do not have to consider margins. Just remember to state which number is width, and which is height, and whi... |
Warning
The answers to this challenge test for a specific version of the patch that helps stop WannaCrypt/WannaCry attacks. Depending on your operating system, you may have a different patch. The best way to protect yourself is to make sure your PC is fully up to date and be careful when opening attachments and web lin... |
Wikipedia: Zeno's Dichotomy Paradox
An infinite number of mathematicians walk into a bar. The first one orders a beer. The second one orders half a beer. The third one orders a fourth of a beer. The bartender stops them, pours two beers and says, "You're all a bunch of idiots."
Reddit
Print the following series for a... |
The Task
This is my first challenge so apologies if it is very simple! In this challenge, your task is to write a program or function which takes in a list of integers and a desired sum and outputs a truthy or falsey value based on whether the list contains two numbers that can be summed together to achieve the desire... |
Objective
Create a function to reverse string concatenation
Input
Two strings (alphanumeric + spaces), where one should be subtracted for the other.
You can assume that the string to be subtracted will never be larger than the other one.
Output
The result from the subtraction
Subtraction
You should remove one strin... |
Challenge
Given an integer \$Q\$ in the range \$-2^{100} ≤ Q ≤ 2^{100}\$, output the number of digits in that number (in base 10).
Rules
Yes, you may take the number as a string and find its length.
All mathematical functions are allowed.
You may take input in any base, but the output must be the length of the number i... |
The task:
Output a value for x, where a mod x = b for two given values a,b.
Assumption
a and b will always be positive integers
There won't always be a solution for x
If multiple solutions exist, output at least one of them.
If there aren't any solutions, output nothing or some indication that no solutions exist.
Buil... |
Your challenge is to find the file extension of a provided filename:
hi.txt -> txt or .txt
carrot.meme -> meme or .meme
lol (undefined behavior)
what..is..this..file -> file or .file
.bashrc -> bashrc or .bashrc
T00M@n3KaPZ.h0wC[]h -> h0wC[]h or .h0wC[]h
agent.000 -> 000 or .000
You must get the text from the last . ... |
What general tips do you have for golfing in 2 dimensional programming languages? I'm looking for tips which can be applied to code-golf problems and are specific to 2D programming languages, but not specific to any one language (Responses like "remove comments" and "use the M operation" are not answers).
Please post ... |
Challenge
Given the phase of the moon, draw it using ASCII art.
Your program must handle new moon, waxing crescent, first quarter, waxing gibbous, full moon, waning gibbous, last quarter, and waning crescent. Your input will be an integer.
0 -> new moon
1 -> waxing crescent
2 -> first quarter
3 -> waxing gibbous
4 -> f... |
Now that other users have helped Trump build the wall, its time for you to climb it.
This is an ascii art challenge where you need to output a climbing wall with randomly placed holds.
A climbing wall is made up of panels each of which has between 3 and 10 holds and is 5 panels high. Each panel is 4 characters high and... |
In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules:
You may only output bytes in the printable ASCII range (0x20 to 0x7E, inclusive), or newlines (0x0A or 0x0D).
Your code must not be a... |
The Fibonacci sequence is a fairly well known thing around here. Heck, it even has its own tag. However, for all that, we sure like to stick to our roots of 1, 1, ... (or is it 0, 1, ...? We may never know...). In this challenge, the rules are the same, but instead of getting the nth item in the Fibonacci sequence, you... |
Sona is in her house with her 10 year old daughter. She needs to go to school to bring back another child from school, as school is over at 2 pm. It's hot outside, so she wants to leave her younger child at home.
She gave a bunch of strings to her child to keep her busy while she is gone. She asked her to reverse the w... |
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 of the year.
For th... |
OUTPUT: The number of seconds since midnight on January 1, 1 A.D., as an integer.
INPUT: None, you must pull the current timestamp yourself.
TASK: This is code-golf, shortest answer in bytes wins.
Standard loopholes apply.
|
(yes, that title was intentional)
Your task is to correct common grammatical mistakes.
You must:
Capitalise the first letter of each sentence, ie the first non-whitespace letter after any of .!? and, additionally, capitalise the first letter of the input
Remove repeating punctuation, such as !!! -> !. Ellipses (...) a... |
Now that I'm thoroughly addicted to Code Golf, it's probably about time that I try to pick up a few golfing languages.
Given that I play almost exclusively in JavaScript, Japt seems like the logical language to start with. I'll be diving into the documentation at the next opportunity I get but, in the meantime, please ... |
There was recently (a few years back) some buzz on programming websites about an implementation of Tetris in 140 Bytes.
...
It turns out that although it is small, it is a simplified version of Tetris, and not even a complete implementation. Only the core logic function fits in 140 bytes of Javascript. To actually run ... |
I have an expression that could be expressed as either of :
a += (A ? B ? x : C ? y : D : D);
a += (A && B ? x : A && C ? y : D);
where A,B,C are expressions of 5-10 bytes each, and x and y are single character literals (3-4 bytes). D is another chain of ternaries (without the branching problem).
I'm getting stuck tr... |
You will be given a two-dimensional array and a number and you are asked to find whether the given matrix is Toeplitz or not. A matrix is a Toeplitz matrix if every descending diagonal, going from left to right, has only one distinct element. That is, it should be in the form:
Input Format:
You will be given a functio... |
I saw this recent Puzzling question:
Add parentheses to make this true
And saw that one answer used a Python script to try all possibilities.
Your challenge is, given an expression (as a string) and an integer, is to make a program that can tell whether you can add parens to make the expression equal the integer.
For ... |
Given a non-empty list of integers, output every possible partitioning of the list where each partition is a non-empty sublist.
So for the list [1, 2, 3, 4] the result is:
[[1, 2, 3, 4]]
[[1, 2, 3], [4]]
[[1, 2], [3, 4]]
[[1, 2], [3], [4]]
[[1], [2, 3, 4]]
[[1], [2, 3], [4]]
[[1], [2], [3, 4]]
[[1], [2], [3], [4]]
The... |
Take a non-empty matrix / numeric array containing positive integers as input. Return, in this order, the sums of the first row and column, then the second row and column and continue until there aren't any more rows or columns.
Suppose the input is:
2 10 10 2 4
9 7 7 2 9
1 7 6 2 4
7 ... |
For this challenge, you must create a programme which takes an integer x and outputs its source x many times.
Rules
This is codegolf, the aim is to golf your programme to have the least amount of bytes
If you submit a function, the function must take x as a parameter and either return or print the entirety of your co... |
A digit word is a word where, after possibly removing some letters, you are left with one of the single digits:
ONE, TWO, THREE, FOUR, FIVE, SIX, SEVEN, EIGHT or NINE (not ZERO).
For example, BOUNCE and ANNOUNCE are digit words, since they contain the digit one.
ENCODE is not a digit word, even though it contains an O,... |
You will be given a number x, where 0 <= x <= 2^32 - 1.
You should output a list of numbers in decimal, after recursive splitting in binary format.
Examples:
Example 1:
255 -> 255 15 15 3 3 3 3 1 1 1 1 1 1 1 1
The current list is just 255.
The binary representation of 255 is 1111 1111. Splitting it, we get 1111 and 1... |
In the video game Minecraft, you can obtain beacons and put them on pyramid-like structures to give you special effects, such as speed or jump boost.
Your task is to, given an effect, construct the beacon pyramid required for it.
There are multiple sizes of beacon pyramids, required for different effects. The largest h... |
Write a proper quine whose every rotation is itself a proper quine.
For example, if your source code is abcdef, then:
abcdef would output abcdef
bcdefa would output bcdefa
cdefab would output cdefab
defabc would output defabc
efabcd would output efabcd
fabcde would output fabcde
A rotation "is made by splitting a str... |
A rotation "is made by splitting a string into two pieces and reversing their order". An object is symmetrical under an operation if the object is unchanged after applying said operation. So, a "rotational symmetry" is the fact that a string remains unchanged after "rotation".
Given a non-empty string s consisting of o... |
Write a program or a function that takes two non-empty lists of the same length as input and does the following:
uses elements of first list to get numerators,
uses elements of the second list to get denominators,
displays resulting fractions after simplification (2/4=>1/2), separated by "+"s,
displays "=" and result ... |
Yesterday, I left my sandwich on the table. When I got up today, there was a bite in it... Was it mine? I can't remember...
Problem:
Take a representation of the sandwich and my bite pattern and tell me if it was my bite or not.
Examples:
Example 1:
My bite pattern:
..
.
Sandwich:
#####
.####
..###
Output:
truthy
Ex... |
Find the original challenge here
Challenge
Given an integer, Z in the range -2^31 < Z < 2^31, output the number of digits in that number (in base 10).
Rules
You must not use any string functions (in the case of overloading, you must not pass a string into functions which act as both string and integer functions). You a... |
(heavily inspired by Element of string at specified index)
Given a string s and an integer n representing an index in s, output s with the character at the n-th position removed.
0-indexing and 1-indexing are allowed.
For 0-indexing, n will be non-negative and less than the length of s.
For 1-indexing, n will be posit... |
Based on this: Make me a square!
You need to output this:
####
# # #
### #
# # #
####
Where "#" is replaced with the input.
If you input "A", you should get
AAAA
A A A
AAA A
A A A
AAAA
If you input "&", you should get
&&&&
& & &
&&& &
& & &
&&&&
Leaderboard
Here is a Stack Snippet to generate both a reg... |
*What is a transmogrifier?
In the C programming language, there are formations called digraphs and trigraphs that are two and three characters sequences that evaluate to less common characters. For example, you can use ??- if your keyboard doesn't have ~.
Given text, replace all instances of the following digraphs and ... |
Disclaimer
It is bad practice to draw out your molecules in 2 dimensions because that is not how they are. I chose to do this in 2D because it is easier to explain.
Note that the bond angles are wrong too: the angle in CH4 is 109.5°, not 90° as I said and the bond angle in NH4 is 107°. BHCl2 does have a bond angle of ... |
The Task
Given a natural number as input, your task is to output a truthy or falsey value based on whether the input is a factorial of any natural number. You can assume that the input number will always be in the range of numbers supported by your language, but you must not abuse native number types to trivialize the ... |
Given text, remove leading and trailing whitespace (spaces, tabs, and newlines).
Alternate title: Implement your own string trimming.
Input
ASCII text (printable + spaces, tabs (\t), and newlines (\n)), in whatever format you would like. Carriage returns (\r) are outside of the scope of the input.
Output
The same text ... |
Task
When running the program must show the season according to the host computer's current time.
Rules
The output must be either: Spring, Winter, Summer or Autumn.
The capitalization does not matter.
The output must not contain anything else the the season names stated above.
A season is 3 months and january is in th... |
This is a cake:
_========_
| |
+________+
| |
+________+
| |
+________+
It is 8 wide, 3 tall, and 1 deep.
You must write a program that makes a cake from 3 inputs. The first input controls how many underscores there are in the middle and =s on the top. Here's the first cake with a width of 10 inst... |
Task: Given the area of a triangle, find a Heronian triangle with that area. Any Heronian triangle with the specified area is allowed.
A Heronian triangle is a triangle with integer sides and integer area. By Heron's formula, a triangle with sides lengths a,b,c has area
sqrt(s*(s-a)*(s-b)*(s-c))
where s=(a+b+c)/2 is ... |
A convenient and useful way to represent topological surfaces is with a fundamental polygon. Each side on a polygon matches to another side and can be either parallel or anti-parallel. For instance the here is the fundamental polygon of a torus:
To figure out why this is a torus we could imagine our polygon being a ... |
Challenge
Given a rectangular area arrange a group of rectangles such that they cover the rectangular area entirely.
Input
An integer denoting the height.
An integer denoting the width.
The dimensions of the rectangles consisting
of the following form: axb,cxd,... where a,b,c, and d are integers - any reasonable for... |
Background
The tabs versus spaces war in programming has been going on a long time, basically because spaces are too low-level to have all the properties you'd want for alignment and indentation, but tabs can't be relied upon to work in all contexts (with some programs optimizing the use of tabs for indentation whilst ... |
A demonic number is a positive integer whose decimal representation consists of only 6. The list of demonic numbers starts with 6, 66, 666, 6666.
Given a positive integer, output the nearest demonic number. If there are two, output the bigger one.
Testcases:
n output
1 6
2 6
3 6
6 6
35 6
36 66
37 66
100 66... |
The Task
In this challenge, your task is to write a program, which takes in no input, with as many anagrams that are quine of themselves as possible.
Your score will be the number of anagrams of your program's source code that are valid quines divided by the total number of anagrams possible, i.e. the percentage of the... |
Do you ever look at 3D shapes and think that we have 2 many dimensions. So let's make 3D into 1D! (See what I did there?)
Task
Given a 2D representation of a cube (layout below), flatten it into a single string, based on pointers.
The CUBE
This is the layout of the cube filled with no-ops (,) and pointers at the corner... |
Sometimes, I have lists of constant matrices in my code:
[ [[1, 0],
[0, 1]],
[[1, 0],
[0,-1]],
[[0, 1],
[1, 0]],
[[0,-1],
[1, 0]] ]
That's a terrible use of screen real estate. I'd much rather write them next to each other:
[ [[1, 0], [[1, 0], [[0, 1], [[0,-1],
[0, 1]], [0,-1... |
I recently created a new language called ;# (pronounced "Semicolon Hash") which only has two commands:
; add one to the accumulator
# modulo the accumulator by 127, convert to ASCII character and output without a newline. After this, reset the accumulator to 0. Yes, 127 is correct.
Any other character is ignored. It ha... |
Output an infinite sequence of positive integers, such that, for each element in the sequence, all positive integers that have not yet been output have a positive probability of being chosen, and no value is repeated.
For example, if the first integer is 3, then 3 may not be output again, but all other positive integer... |
Introduction:
You are a worker, who is in charge of managing a set of bridges, connecting a square grid of "nodes":
N - N - N
| | |
N - N - N
| | |
N - N - N
(the grid here is 3 by 3, but they can be larger).
Each of the bridges has a set capacity from 1 to 10, and each of the bridges has a number of cars over... |
Challenge
Find the oxidation states of each of the atoms in a given molecule. These can be output as a list or otherwise.
Rules
The total oxidation state of a molecule will always be zero. The total oxidation state is the sum of the oxidation states of each of the individual atoms in the molecule.
The following atoms h... |
Challenge
Given a number, x where -1 ≤ x ≤ 1, and the integers a and b, where b > a, solve the equation sin(θ) = x for θ, giving all solutions in the range a° ≤ θ ≤ b°.
Rules
x will have a maximum of three decimal places of precision. The output, θ, must also be to three decimal places, no more, no less.
Your output ma... |
Target:
Write a floor() function from scratch.
Manipulating like converting float to string, and cutting all after dot are allowed.
All languages are allowed.
Any usage of built in language functions (like toInteger()) or similar is not allowed, casting operators are not allowed.
So, your task is implement floor() func... |
Challenge
Given a positive integer, determine whether it is a triangular number, and accordingly output one of any two constant, distinct values.
Definition
A triangular number is a number that can be expressed as the sum of consecutive positive integers, starting at 1. They can also be expressed with the formula \$\fr... |
A mad scientist has just created a new species of bacterium! He has decided to name it Noblus Gentlemanus, after observing its behaviour. However, his bacteria have ran out of food, and have declared war, as they are able to harvest other bacterium's corpses for enough food to create copies of themselves. There are ... |
Related to: Make a ;# interpreter
In the above linked challenge the task was to create an interpreter for the esoteric language ;#.
The ;# language
The language has exactly two commands: ; and # (all other characters are ignored by the interpreter):
;: Increment the accumulator
#: Modulo the accumulator by 127, print t... |
The Task
In this challenge, your task is to write some code which outputs one of its anagrams chosen randomly with uniform distribution but it should never output itself.
Elaboration
Given no input, your program should output any one of the anagrams of its source code. Your program should never output its own source a... |
Jarl Olaf lives in a beautiful village, Stackholm. In every year he is thinking about raiding a place to get some golden jewelery, food and programmers woman slaves.
He is a good person but not the brightest one, so you need to help him decide the next target. He has three targets in his mind: Jarl Burg, England and Pa... |
The famous Fibonacci sequence is F(0) = 0; F(1) = 1; F(N+1) = F(N) + F(N-1) (for this challenge we are beginning with 0).
Your challenge: Given n, output the sum of all the dth Fibonacci numbers for all divisors d of the nth Fibonacci number. If you prefer more formal notation,
Input: a positive integer n
Output: the... |
Challenge:
Write a program that produces the following output:
. E .. I ... S .... H
...- V
..- U ..-. F
..--
.- A .-. R .-.. L
.-.-
.-- W .--. P
.--- J
- T -. N -.. D -... B
... |
Introduction
Wardialing was a very interesting way to try to hack people back in the '80s and '90s. When everyone used dial-up, people would dial huge amounts of numbers to search for BBS's, computers, or fax machines. If it was answered by a human or answering machine, it hung up and forgot the number. If it was answe... |
I live in the UK, where it rains. A lot. I also have the unfortunate necessity to need to wear glasses to see, which means that when it rains (as it is now), I can barely see out of them. This challenge is so that you can all experience the same!
Task
Output ASCII art glasses with a drop of water added each second.
Inp... |
;# is a very simple language. It has 2 commands:
; will increment the accumulator
# outputs the accumulator modulo 127, and then resets the accumulator
;$ is also very simple and is very similar (and also does not yet exist). It has 2 commands:
; will increment the accumulator
$ outputs the accumulator modulo 127. H... |
Output this binary sequence of length 1160:
-++-+--++-++-+--+--++-+--+--++-+--++-++-+-++--++-+---+-++-+--+--++++--+--++-+--++-++----++-++-+-++--++-+-+---++-+--++-++-+--++-+--+---+-++-+--++-++-+--+--++-++-+--++-+--+++-+-+----+++-+--+--+++---++-++-+--+--+++--+-+-+--+-+++-++-+--+--++-+--++-++-+--+--++--+++---+++-+---++-+-... |
Poke is a really simple incomplete-information game. It's like "Poker", but simpler. At the start of every round, each player is dealt a hand. To simplify things, a hand is a uniformly distributed random number between 0 and 1. Each player only knows their own hand. The player that wins the round is the one whose hand ... |
Your program is given a string consisting entirely of lowercase letters at STDIN (or closest alternative). The program must then output a truthy or falsey value, depending on whether the input is valid romaji.
Rules:
It must be possible to divide the entire string into a sequence of kana without any leftover characte... |
Your challenge is to take a name (string) as input, like
Albert Einstein
and output:
Einstein, Albert
Pseudocode:
set in to input
set arr to in split by " "
set last to the last element of arr
remove the last element of arr
set out to arr joined with " "
prepend ", " to out
prepend last to out
output out
More test c... |
In Rocket League, there are controls assigned to quick chat. For PC, they are
1, 2, 3, and 4. To use a quick chat, you must press two controls. For example, the first option would be 1, 1.
You will be simulating the Rocket League client. You will be given a non-empty list composed only of four characters of your choosi... |
Because we haven't had enough of these, let's do another weird language!
+ increments the accumulator
- decrements the accumulator
# outputs the character with the codepoint of the accumulator modulo 127, and then resets the accumulator
$ is like # but it doesn't reset the accumulator
% reads a single character of inp... |
A Directed Acyclic Graph (DAG) is a type of graph that has no cycles in it. In other words, if there is a link from node A to node B, there exists no path from B to A (via any nodes).
Challenge
Determine whether the directed graph given as input is acyclic.
Input
A list of lists of integers representing the links betwe... |
Suppose you have two six-sided dice. Roll the pair 100 times, calculating the sum of each pair. Print out the number of times each sum occurred.
If a sum was never rolled, you must include a zero or some way to identify that that particular sum was never rolled.
Example Output:
[3, 3, 9, 11, 15, 15, 11, 15, 7, 8, 3]
... |
Introduction
Sometimes I get bored and there are no new questions on PPCG, so I want you to dig a random question from PPCG's past.
Challenge
Given a user's PPCG ID as input (e.g. my ID is 30525), output the URL of a randomly chosen PPCG question. If the question does not meet the following criteria, you must choose an... |
Introduction
Alice is a 2-d language by Martin Ender which has two different execution modes, cardinal and ordinal. When the instruction pointer passes through a mirror (either / or \), it switches from one mode to the other one.
In this challenge we will focus on ordinal mode, where commands operate on strings and the... |
Contest permanently opened - Updated August 10th 2017
Even though on June 5th 2017 I declared a winner (who will be kept as the best answer) I'll be rnning new bots and updating the results.
June 5th Results
Congratulations user1502040
Since there are no ties, I only show the % of matches won.
Statistician2 - 95.7%
Fit... |
A common year is a year that is not a leap year and where the first and last day of the year are on the same day. A special common year is one that starts on a Monday and so ends on a Monday as well.
Your challenge is to create a program/function that when given a year as input finds the nearest special common year, o... |
Input:
The input will be a string of any characters.
Output:
the output will be an emojified (discord emojis) version of the input string. The way it will work is as so:
Letters: a-z (case insensitive) will become ':regional_indicator_lowercase letter here:'
e.g 'A' will become ':regional_indicator_a:'
Digits: any digi... |
Given 2 non-negative integers as input, output a non-negative integer that cannot be created through any mathematical operators on the 2 inputs.
For example, given inputs 2 and 3, 6, 0, 5, 1, 9, 8, 23, 2 are all invalid outputs.
Operations that must be taken into account are:
Addition (a + b)
Subtraction (a ... |
Given a list or delimited string, output a list or delimited string with the first character of each word one word later.
For this challenge, a "word" consists of only all printable ASCII characters, except the space, newline, and tab character.
For example, take the string "Good afternoon, World!" (space-delimited):
1... |
A Pythagorean Triple is a positive integer solution to the equation:
A Trithagorean triple is a positive integer solution to the equation:
Where Δn finds the nth triangular number. All Trithagorean triples are also solutions to the equation:
Task
Given a positive integer c, output all the pairs of positive integers... |
According to this XKCD comic, there is a formula to determine whether or not the age gap in a relationship is "creepy". This formula is defined as:
(Age/2) + 7
being the minimum age of people you can date.
Therefore a relationship is creepy if either of the people in said relationship are younger than the minimum age ... |
Challenge
Weirdly, this hasn't been done yet: output the current date.
Rules
The date format you should follow is as follows:
YYYY-MM-DD
Where the month and day should be padded by zeroes if they are less than 10.
For example, if the program is run on the 24th May 2017, it should output
2017-05-24
The date can either... |
Klein is a 2D language I have designed that can be embedded on 12 different topological surfaces. A Klein program can be run on different surfaces by changing the command line arguments.
The topology determines where the instruction pointer goes when it goes off the edge of the program. When moving off of the edge th... |
Inspired by: Find an Unrelated Number
Challenge
Given two positive integers as input, output the mathematical operations that can be used on those inputs to generate every number from 1 to n inclusive where n is the smallest prime greater than the sum of the two inputs. If the number cannot be generated using the list... |
Related to: Make a ;# interpreter and Generate ;# code
;# - A Whirlwind Guide
This is a simple language with two commands. Its only data structure is an accumulator, which is initialized to 0.
; Increment the accumulator
# Calculate the value of the accumulator modulo 127, and print the corresponding ASCII character.... |
I'm new to this code-golfing thing and I'm very interested in CJam.
Is there a way to get all the current stack as an array? I think I can do it with something like [1$ 2$...n$] but I would have to get the stack's length and use some kind of iterator (or use a fixed length stack... useless). But is there a way to achie... |
Given a string as input, output a number of whitespace characters (0x0A and 0x20) equal to the length of the string.
For example, given the string Hello, World! your code would need to output exactly 13 whitespace characters and nothing else. These can be any mix of spaces and newlines.
Your code should not output any ... |
Challenge
Given a Youtube playlist, output the number of videos in it.
I/O
The playlist will be given as an URL; for example, https://www.youtube.com/playlist?list=PL_3jnZNPYn7qUatgDYBS5NShkfXoehSRC (this is a playlist a friend sent me to try to get me to listen to K-Pop because she's obsessed with it and I don't like ... |
Inspired by the recent craze over another two character language, ;#
Intro
According to community consensus, acceptable answers on this site must use programming languages that, at minimum:
Can determine if a natural number is prime
Can add two natural numbers together
Can represent a list/tuple of numbers, as well as... |
Introduction
Apparently, this question has been asked here and it unfortunately closed. I thought it was a good idea to try again with it, but done right.
XKCD looks at the how we are trained to use "hard to remember passwords", thinking it's secure, but instead, would take a computer 3 days to crack. On the flip side... |
As a couple of people may have noticed lately, I've largely abandoned development of Braingolf because it's boring and uninspired, and moved on to 2Col which is a little more interesting, and not designed to be a golfing language.
The defining feature of 2Col is that every line of code must be exactly 2 characters long... |
For today's challenge, you must write a program or function that alternates the case of a string. However, you must ignore non-alphabetic characters. This means that every alphabetic character must have a different case than the preceding and following alphabetic character. This is slightly more complex than uppercasin... |
The input will be two five letter words. They don't actually have to be dictionary words, just any five letters each, all lowercase or all uppercase, your choice. Only A-Z will appear in the input words and they will always be 5 characters in length.
Your program is to score them both as though they were poker hands an... |
Task
Write a program or function that, given a string and a list of strings, replaces each occurrence of an element of the string list contained in the string with the next element of the string list.
Example
The string is The cat wore a hat on my doormat so I gave it a pat and the list is ["at","or","oo"], we observe ... |
I cannot believe that this hasn't been done before but I may be wrong. If so, just close as dupe.
This challenge is very similar to Is it truthy or falsy? but, IMO, isn't close enough to be a dupe. That has predefined "falsy" variables that all languages must use, some of which aren't even falsy; this uses your own fal... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.