instruction stringlengths 34 53.1k |
|---|
And no, This is not a dupe of Translate ASCII text to braille.
There are 28=256 Braille patterns in Unicode. (By 'Braille' I mean 8-cell ones)
W, wait. How many ASCII characters were there?
27 = 128?
Well then, Let's turn ASCII into Braille, 'cause there is absolutely no reason not to!
The way from ASCII, to Braille... |
Everyone is likely familiar with the following song, which is a musical round:
Background
Fewer people might recall trying to sing the 4-person version of this with a few friends and failing. Offsetting the lyrics of a song with different harmonious pitches is known as singing a "round" and that's what we're here to s... |
The ECMAScript 6 standard added many new features to the JavaScript language, including a new arrow function notation.
Your task is to write a basic ES6-to-ES5 transpiler. Given only an ES6 arrow function as input, output its ES5-compatible counterpart.
It's code-golf! May the shortest program in bytes win!
The Basics... |
This is a good beginner challenge and a good time killer.
I only said a -natural- log because the title was too short, this has nothing to do with logarithms.
Given 2 variables:
The number of ants n.
The width of the log w.
Output a log of width w with n ants (Example shown w=3, n=6)
| |
| \O/ \O/ \O/ |
... |
Charcoal is a language created by ASCII-only and DLosc that specialises in ASCII art challenges.
What tips do you have for golfing in Charcoal? Obviously I am looking for tips related specifically to Charcoal, not those which can be applied to most - if not all - languages.
|
Spring has recently arrived, and it is almost the time when flowers start to sprout. So I want you to help them grow.
Your task:
Given two numbers, m, and n, output m flowers randomly placed on an n*n grid.
A single flower looks like this:
&
|
A flower's position is defined by where its & is. When randomly placing two... |
Challenge
Given a SE user's ID, output the sum of their reputation from across all of the Stack Exchange networks the user has signed up to.
Rules
If a user has 101 or less reputation on a site, count it as zero in the sum.
You should not count Area 51 rep or hidden communities!!
URL shorteners are disallowed.
Example... |
For robbers' post, Cheapo Enigma machine (Robbers)
A cop's submission will consist of a program/function that accepts a single byte of data and return a single byte of data. Every possible input must produce a unique output. (In the other words, your function must be bijective)
Robbers will attempt to create the invers... |
For cops' post, Cheapo Enigma machine (Cops)
A robber's submission consists of a program/function that accepts the output of a cop's code and returns the input for all the outputs provided by that cop's code. (In other words, you must write the inverse function)
You cannot use built-ins that have the sole purpose of ha... |
Background:
Okay, i dropped my android smartphone and damaged the touchscreen
The lower half (yeah, exact half!) is spider-webbed and does not work (potrait-mode)
Fortunately for me, the display itself is working
My phone is already rooted and adb enabled, so i have managed to enable 360 degree display rotation
Using t... |
You know how you get a voicemail message and the person's connection wasn't great, and you're trying to figure out how to call them back, but you're not sure if that was a "5" or an "8" they said?
That's this challenge.
The good news is that the caller read off their number twice, but it's garbled in both places.
Your ... |
From Wikipedia:
Chopsticks is a hand game for two players, in which players extend a number of fingers from each hand and transfer those scores by taking turns to tap one hand against another.
In this challenge "splits" can only be 4->2+2 or 2->1+1.
Challenge
Your challenge is to make a bot (think the AI and framewor... |
Introduction
You started to write a "Hello, World!" program, but after you wrote the part to print the hello, you forgot what your program should actually print. So now, you somehow managed it to write a program which can check if the entered word is what you search.
The task
Your task is to write a program or function... |
Your task: make a hexagonal triangle with side length n, where n is a positive whole number or 0.
First, let me define a hexagon:
/ \
| |
\ /
(Amazing ASCII art, right?)
Hexagons can be linked together by sharing sides:
/ \ / \
| | |
\ / \ /
/ \
| |
/ \ /
| |
\ /
A hexagonal triangle is the fo... |
I saw a cool gif of the twin dragon curve made from a square, and wondered what would happen if we started from another base image. So I wrote a program to do this.
It's so cool that I thought it would be fun to do it as a challenge.
Task
You will take in a square image with an ... |
Your task is to create a program which, given an input string, will output the first Google autocomplete result for that search. The format of input/output is up to you.
Rules
Your program must take 1 input, a string, and output the top Google autocomplete/auto-fill suggestions result. The format of input/output is up... |
Do you have any code-golf tips for writing in SOGL, a golfing language created by dzaima?
Your tips should be at least somewhat specific to SOGL.
Please post one tip per answer.
|
Intro
Reverse and add is as simple as it sounds, take n and add it to its digits in reverse order. (e.g. 234 + 432 = 666).
If you apply this process repeatedly some numbers will eventually hit a prime number, and some will never reach a prime.
Example
I currently have
11431 rep.
11431 is not prime
11431 + 13411 = 2484... |
Challenge
Given two question IDs, try to figure out how similar they are by looking at the answers.
Details
You will be given two question IDs for codegolf.stackexchange.com; you may assume that there exist questions for both IDs that are not deleted, but are not necessarily open. You must run through all of the answer... |
You must make a polyglot that outputs its source code in one language and its source code backward in another. Unlike the normal rules, you are allowed to read the current file or use a builtin to get the source code of your submission and reverse that in one language. Your source code cannot be a palindrome.
For examp... |
In: a string without line breaks*
Allow the user to edit and submit the line
Out: the modified string (optionally with a trailing linebreak)
The line editor must at minimum allow the user to:
move a visible cursor left and right
insert and/or overwrite characters at the cursor position
remove characters at the curso... |
Your task is to determine how much of a perfect palindrome a string is. Your typical palindrome (eg 12321) is a perfect palindrome; its perfectness is 1.
To determine the perfectness of a string, you see how many sections you can split it into where each section is a palindrome. If there are ambiguities, such as with a... |
Task:
Your task is, when given three inputs:
a numerator n
a denominator d
another integer, x
Create a program/function that finds the xth digit of the number after the decimal place.
Specs:
The range of n and d is between 1 and 2^31 - 1, inclusive.
The range of x is between 1 and 10,000,000, inclusive.
You may ch... |
There was a discussion going on in TNB once about the best temperature scale, and we agreed on something: Take the average of all four main temperature scales! That is, Celsius, Kelvin, Fahrenheit, and Rankine (Sorry Réaumur).
So, now the issue is, most people don't use this system. So, I need a program to convert back... |
If you're going to invent some fake news, you'll want to fabricate some data to back it up. You must already have some preconceived conclusions and you want some statistics to strengthen the argument of your faulty logic. This challenge should help you!
Given three input numbers:
N - number of data points
μ - mean o... |
This challenge was inspired by @HelkaHomba's excellent challenge Red vs. Blue - Pixel Team Battlebots. That challenge was probably the best one I've seen on this site. Ever.
My challenge is still a lot different, but @HelkaHomba deserves credit for the inspiration.
Overview
This is a team king-of-the-hill where your t... |
I read this question and thought it would make a nice challenge.
Task
Give an input 0<n<10 generate a random number with
exactly n digits
the first not a 0
so f(n)>10**(n-1)-1
distinct digits
Winning criteria
This is code-golf so shortest code wins.
Random
I mean evenly distributed random. So from the view of the ... |
Circa 1976. With the success of the Tiny BASIC Design Note, a variety of Tiny BASIC IL implementations now span a range of microcomputers. The time has come to expand the Tiny BASIC standard.
Grammar revisions:
(LET) var = expression
INPUT (string ,) var-list
PRINT expr-list (;)
IF expression relop expression (THEN) st... |
I was watching the world snooker championship and it got me wondering..
Snooker scoring
In the game of snooker there are certain rules that you must adhere too:
When there are red balls on the table, during your turn you must first pot a red ball
After potting each red ball, you must pot a colored (not red) ball (the ... |
As you may know it, the factorial of a positive integer n is the product of all the positive integers which are equal or smaller to n.
For instance :
6! = 6*5*4*3*2*1 = 720
0! = 1
We will now define a special operation with an irrelevant name like sumFac:
Given a positive integer n, sumFac(n) is the sum of the factori... |
Definitions
You can skip this part if you already know the definitions of groups, finite groups, and subgroups.
Groups
In abstract algebra, a group is a tuple (G, ∗), where G is a set and ∗ is a function G × G → G such that the following holds:
Closure: for all x, y in G, x ∗ y is also in G (implied by the fact that ∗... |
In preparation for the AP Computer Science AP Test (Java), our teacher has been giving us FRQs from previous years for practice.
My friend and I were golfing this during class today and got it as short as we could, but I'd like to see if there are any shorter solutions any of you can come up with.
Rules:
You must use ... |
Given a number n and an upper limit l list the numbers that can be created by multiplying two or more numbers consisting of only sevens of length n or less that are less than l. A161145 is close to this challenge, however, you will NOT be including the 7, 77, 777, 7777, 77777, etc..
Examples
n=anything, l<49 would resu... |
Consider a connected undirected graph. A matching set of edges on this graph is defined as a set of edges such that no two edges in the set share a common vertex. For example, the left figure denotes a matching set in green, while the right figure denotes a non-matching set in red.
A matching set is said to be maximal... |
Ah, yet another of my selfish uses of this Stack.
Being a Chromebook owner, I'm a frequent user of the Ace IDE, the editor used by Cloud9. It has lots of tools for dealing with excess whitespace, but it notably lacks one: clearing empty lines.
Your mission today is, given an input from a place I can copy-paste to [;)],... |
What I want:
Quite simply, I want a text based display, that asks for an input, n, then shows that value on the display! But there's a catch. Each of the 'true' 'pixels' (the ones filled in) has to be represented by that number n..
Example :
You are given an input n. You can assume n will be a single digit
Input: 0
O... |
This question is the first of several Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday! You can find more information about Brain-Flak's Birthday here
Last summer we had the Brain-flak Integer Metagolf, and the answers it generated have been very useful to the Brain-Flak community sinc... |
Dennis puts in a huge amount of effort for this community, including as moderator, language designer, and provider of TIO.
Unfortunately, his four-year-old daughter has caught a cold, so let us all help him keep track of her recovery (may it be speedy) by providing him with a thermometer:
.-----------.
| |
| ... |
The French spell out numbers in a peculiar way.
1-16 are "normal"
17-19 are spelled out 10+7. 10+8, 10+9.
20-69 are "normal" (OK, OK! Not really, but they are in this challenge)
70-79 are 60+10, 60+11 ... 60+10+7, 60+10+8, 60+10+9.
80-99 are 4*20, 4*20+1, 4*20+2 ... 4*20+16, 4*20+10+7, 4*20+10+8, 4*20+10+9
Challen... |
Inspired by a question over at Stack Overflow. The title here is entirely my fault.
The challenge
Given a list of positive integers containing at least two entries, replace each number by the minimum of all entries excluding itself.
Test cases
[4 3 2 5] -> [2 2 3 2]
[4 2 2 5] -> [2 2 2 2]
[6 3 5 5 8] -> [3 5... |
Given a positive integer < 100 (from 1 to 99, including 1 and 99), output that many lockers.
A locker is defined as the following:
+----+
| |
| |
| |
| nn |
+----+
where nn is the locker number, in base 10. If there is 1-digit number, it is expressed with a 0 in front of it. For example, locker number 2 displ... |
Backstory
You wake up dizzy in a chemistry laboratory, and you realize you have been kidnapped by a old mad chemist. Since he cannot see very well because of his age, he wants you to work for him and only then, you can escape the laboratory.
Task
It is your task to return the structural formulae of the molecules whose ... |
Your task is to translate a 103-smooth number into an English word, using the method described below.
How?
Generate the list of prime factors (with repetition) of the input number.
Sort the list:
If 2 is not one of the prime factors, sort the list in ascending order.
If 2 is one of the prime factors, remove it from ... |
...or is there?
Your challenge is to parse my lunch bill, which contains the base price, tips, discounts, coupons, and extras and find out if my lunch was $0 or less. If this is the input:
12.34
15 tip
25 discount
1.5 extra
2 coupon
Then the output might be false. Here's how it works:
12.34 is the base price.
15 tip m... |
This question is the second of several Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday! You can find more information about Brain-Flak's Birthday here
Challenge
For this challenge you'll be generating all fully matched strings from a list of brackets. To borrow DJMcMayhem's definition... |
Recently, I've seen Hare Krishna people with their mantra on the emblem and I've found it may be quite interesting to code golf.
The challenge
Write the Hare Krishna mantra, i.e.:
Hare Krishna Hare Krishna
Krishna Krishna Hare Hare
Hare Rama Hare Rama
Rama Rama Hare Hare
Winning criteria
This is code-golf, so shortest... |
Given a string s and an array/list l, determine whether or not s can be made with parts from l.
For example, if the string is "Hello, world!" and the list is [' world!', 'Hello,'], then the program/function should return a truthy value, because you can arrange the list to form the string. The following list would also ... |
Say you list the positive integers in a triangle, then flip it left-to-right. Given a number, output the number it's sent to. This is a self-inverse mapping.
1 1
2 3 3 2
4 5 6 <---> 6 5 4
7 8 9 10 10 9 ... |
m|Y bR|ain is We|iRd. F(o)R T(h)E La|sT fi(v)e YE|ars O|R s|o, (I) ha|ve C(u)T wO|rds in h(a)lf wh|En (I) s(e)e Th|em. Wh|EN I started Do|ing it, it To|oK a meN|TaL effort - B(u)T I almost cou(l)dn't N(o)T d|o it. N(o)w, I d|o it in the back of my head, a(n)d hardly ev|en not|iCe it. However, I thought this wo|uld make... |
The alphanumeric characters have ASCII-values:
0-9 -> 48-57
A-Z -> 65-90
a-z -> 97-122
Your challenge is to take an integer as input, and output how many characters can be made using consecutive digits of that number. The character codes may be overlapping. 666 should result in 2, since you have 66 twice.
Test c... |
Write functions \$x(a)\$, \$y(a)\$ and \$z(a)\$ such that for any rational \$a\$ all functions return rational numbers and
$$x(a) \times y(a) \times z(a) \times (x(a) + y(a) + z(a)) = a$$
You may assume \$a \ge 0\$
You do not need to use rational types or operations in your program, as long as your program is mathemati... |
Your task is to write a program that outputs the exact string Programming Puzzles (trailing newline optional), but when all spaces, tabs, and newlines are removed it outputs Code Golf (trailing newline optional.)
Your byte count is the count of the first program, with spaces still there.
Notes
The spaces in Code Golf... |
This is a variant on the self-replicating program, defined here as a program that outputs its source (or a quine). Below is an example of a self-replicating program in Python:
s = 's = %r\nprint(s%%s)'
print(s%s)
When run from a file, this script should output itself.
Instead of a self-replicating program, I want you ... |
The keyboard layout people commonly use is the QWERTY layout as shown below.
But there are also other keyboard layouts:
DVORAK
COLEMAK
WORKMAN
Your task
Your code will take two inputs: the name of the keyboard layout and a string to transcribe.
Your goal is to convert your QWERTY input as if you were typing with t... |
What I want:
Take an input, x
Take a formula. It has to be capable of reading something in the format:
ax^m + bx^n + cx^o ... where m, n, o and any terms after that can represent any value.
coefficients, again for any number. For example, 6x^2. (That means 6(x^2))
Doesn't necessarily have to put up with spaces
times, ... |
Your task is to find the nth Fibonacci number, but n is not necessarily an integer.
The Fibonacci sequence, 0-indexed, goes as follows:
0, 1, 2, 3, 4, 5, 6, 7, ...
1, 1, 2, 3, 5, 8, 13, 21, ...
However, what happens if we want the 2.4th number?
The 2.4th number is 0.4 times the difference between the 3rd and 2nd F... |
This was one of a series of challenges leading up to Brain-Flak's birthday. Find out more here.
Challenge
For this challenge your objective will be to find the very first pair of matching brackets in a fully matched string of ()[]{}<> brackets. To borrow DJMcMayhem's definition of a fully matched string:
For the pur... |
Taken from: OEIS-A071816
Your task, given an upper bound of n, is to find the number of solutions that satisfy the equation:
a+b+c = x+y+z, where 0 <= a,b,c,x,y,z < n
The sequence starts out as described on the OEIS page, and as below (1-indexed):
1, 20, 141, 580, 1751, 4332, 9331, 18152, 32661, 55252, 88913, 137292, ... |
Logo is a programming language that was designed back in 1967 that has great potential for creating graphics in relatively few bytes compared to other languages.
Logo is an educational programming language that utilizes Turtle Graphics.
There are multiple interesting implementations of Logo including:
Apple Logo
Atari... |
Definitions
Euler Phi Function (AKA totient function): a function which takes in a positive number and returns the number of positive numbers less than the given number which are co-prime with given number. It is denoted as φ(n).
Reachable number: if there exists a positive integer x such that φ(x) == n, then n is rea... |
Brain-flak turns one year old tomorrow! In honor of it's birthday, we're having a PPCG style birthday party, where several users post brain-flak related questions! Help us celebrate! :)
Brain-flak is an esoteric language I wrote where all of the commands are brackets and all of the brackets must be fully matched. To... |
After giving back the results of the last topology exam to his students, Pr. Manifold was worried about complaints.
Since he is aware his students know where his office is located, Prof. Manifold decided to transform his office into a bunker with a 10 digit password (all characters are digits).
But he suspected his st... |
Given a non-negative number n, sort the digits of n by their first occurrence in pi.
Input can be taken via function cli argument, or STDIN and as a string, char[] or integer. You may output via return value, exit status or STDOUT.
|
I am currently working on a golfing language. Do you have any suggestions for this language? What are some helpful features of a good golfing language? What features do you find useful? Do you suggest a language based on variables, stack(s), tapes, registers, etc?
As usual, please post separate tips in separate answers... |
I am writing a golfing language.
Do you suggest variables, stack(s), tapes, registers, etc for storage in a code-golf language? What about implicit input?
Rough definitions:
A variable is simply a name (usually one character long in golfing languages) that a value can be assigned to, and later retrieved by that name.... |
Challenge:
I have thousands of songs in my music collection, and luckily for me, my favorite player has a search function. I also have a great memory—I can remember the title of every song in my collection. However, I'm very lazy and don't like to type—each extra keystroke is a chore!
What is the shortest string I mus... |
The problem is I need to skip or delete all the lines between the two keywords in a file and the keyword pair will appear many times in the file.The file looks something like this
.
.
..........
..........
Hello world
..........
..........
welcome
.
.
.
..........
..........
Hello world
..........
..........
welcome
.
... |
This question is part of a series Brain-flak Birthday challenges designed to celebrate Brain-Flak's first Birthday. You can find more information about Brain-Flak's Birthday here.
Today is Brain-Flak's first Birthday! So I thought we would throw it a surprise birthday party. So in your favorite language print
Surp... |
In this challenge, you will calculate what your reputation would be, if the reputation cap didn't exist on PPCG.
Everyone can access the rawdata for reputation changes on the adress: codegolf.stackexchange.com/reputation.
The raw data follows a setup like this (these are the first few lines of my version of the page.
t... |
Challenge
You will be given an input string, anywhere the word "Lemon" is found it should be converted to "Lemonade" but the a, d, and e must be borrowed from somewhere else in the sentence.
Example
Example Input:
I found a lemon when I was a kid
Example Output:
I foun a lemonade whn I was kid
The Lemonade was c... |
Write a program to replace all occurrences of "force" with "first" and all occurrences of "first" with "force", keeping the original case for all character positions:
"ForcefoRcefOrcE" -> "FirstfiRstfIrsT"
"FirstfiRstfIrsT" -> "ForcefoRcefOrcE"
The rest of the string must stay unchanged, and so running your program tw... |
Definitions
A subsequence may not be contiguous, e.g. [1, 1, 1] is a subsequence of [1, 2, 1, 2, 1].
An equal subsequence is a subsequence in which every element is equal.
The longest equal subsequence may not be unique, e.g. [1, 1] and [2, 2] are both longest equal subsequences of [2, 1, 1, 2].
Input
A non-empty lis... |
Intro
We have had histograms and counting, but not listing all of them.
Every year, Dyalog Ltd. holds a student competition. The challenge there is to write good APL code. This is a language agnostic code-golf edition of this year's sixth problem.
I have explicit permission to post this challenge here from the original... |
This is a CMC (chat mini challenge) that I posted in our chatroom, The Ninteenth Byte, a bit ago.
The Challenge
Given a positive integer x, depending on the last 2 bits of x, do the following:
x & 3 == 0: 0
x & 3 == 1: x + x
x & 3 == 2: x * x
x & 3 == 3: x ^ x (exponentiation)
Input/Output
Single Integer -> Single Int... |
Challenge
Given a user's ID, determine how many times they have hit the repcap.
Specs
On a given day, let's a user has hit the repcap if they had reputation that wasn't gained due to the repcap. Essentially, on any given day, if the user's net reputation change as calculated without any cap was different from their act... |
You must write a program or function that, when given a nonempty string S of N printable ASCII characters†, outputs a program that will exit with exit code C, where C is the ASCII codepoint at position 0 in S. This program you write will additionally output a program P, such that, when run, it exits with exit code C′, ... |
The Australian Apparent Temperature (aka, wind chill) in °C AT is given by this algorithm from the Australian Bureau of Meterology (wp, source):
AT = Ta + (0.33 * e) - (.7 * ws) - 4.0
Where:
Ta = Dry bulb temperature (°C)
e = Water vapour pressure (hPa)
ws = Wind speed (m/s) (at an elevation of 10 meters)
The water ... |
You must take two lists of positive integers as input, let's call these n and m.
You may assume that:
All integers in n are part of m
All integers in m are unique
The lists are non-empty
Challenge: Return the indices of where you find the values in n, in m.
That might be confusing, but I think the test cases will ma... |
Given an integer n, decompose it into a sum of maximal triangular numbers (where Tm represents the mth triangular number, or the sum of the integers from 1 to m) as follows:
while n > 0,
find the largest possible triangular number Tm such that Tm ≤ n.
append m to the triangular-decomposition representation of n.
subt... |
Task
You will be given a string in the input consisting only of the characters from a to z, i.e. the input will match the regex /^[a-z]*$/.
Your output should be a complete program in the same language, whose source code contains the input, and is a proper quine.
Example
Your program would receive the input abc and out... |
Output the device's screen resolution in the specific format of [width]x[height](without the brackets). For example, an output could be 1440x900.
Here's an online tester that you can use to check your own screen resolution.
|
Your task is to write a piece of code that zeros the current cell in the Brainfuck variant that, each cell can contain a signed integer of arbitrarily large magnitude, instead of the normal 0 to 255.
You may assume there are l cells to the left and r cells to the right of the current cell that are initially zero. You p... |
Task
Given a non-negative integer n, output 1 if n is 0, and output the value of n otherwise.
Input
A non-negative integer.
If you would like to accept the string as input, the string would match the following regex: /^(0|[1-9][0-9]*)$/, i.e. it must not have any leading zeroes, except when it is 0.
If you accept a re... |
I'm currently scanning a bunch of handwritten documents and converting them to .txt files. Since I have a terrible handwriting the .jpg->.txt converter converts some of my umlauts to the "normal" letter encased by '
Task
Write a program or a function that:
Is given a string
you can choose any I/O codepage as long as
... |
One of my favorite types of challenges on this site are restricted-source challenges. These challenges impose a computer tractable restriction that the sources of potential answers must pass. I like these challenges so much I have been working on a golfing language designed to win at these challenges for some time no... |
Task
Given an array of positive integers, replace each element with the parity of the sum of the other elements. The array is guaranteed to have at least 2 elements.
Definition
Parity: whether a number is odd or even.
Example
For the array [1,2,3,1]:
Replace 1 with the parity of 2+3+1, i.e. even.
Replace 2 with the ... |
Your challenge is to output this:
https://stackoverflow.com/
https://serverfault.com/
https://superuser.com/
https://meta.stackexchange.com/
https://webapps.stackexchange.com/
https://gaming.stackexchange.com/
https://webmasters.stackexchange.com/
https://cooking.stackexchange.com/
https://gamedev.stackexchange.com/
ht... |
Some text-based rogue-likes don't let you walk into walls, and give you your move back if you try to. Why do that when you can make the player move in the closest valid direction?
The challenge
Write a program of function that, given a direction and a 3 by 3 grid of characters, outputs the same grid after the player ha... |
Introduction
By definition, unique identifiers should be unique. Having multiple identifiers that are the same causes one to retrieve unexpected data. But with data arriving concurrently from multiple sources, it can be difficult to ensure uniqueness. Write a function the uniquifies a list of identifiers.
This is po... |
Task
Given a non-empty array of 0 and 1, halve the lengths of the runs of 0.
Input
An array of 0 and 1. Acceptable format:
Real array in your language
Linefeed-separated string of 0 and 1
Contiguous string of 0 and 1
Any other reasonable format
For example, the following three inputs are all acceptable:
[1, 0, 0, 1]... |
Challenge
Supplied an image, you must determine if the subject of the image is a bird or a plane.
If the image is a bird, your program must output
bird
and if the image is a plane, your program must output
plane
Your program must produce no other output and the testing program will be case sensitive.
Further informat... |
Output terminal dimensions (columns and rows) in any two-number decimal format*. For example, an output could be 80x25.
Inspiration. Prompt.
* Output must have both measures on a single or two consecutive lines, and there may be no more than one leading and/or trailing line of output (optionally followed by a newline)... |
SE will be down/read only today 2017-05-04 at 00:00 UTC until 00:20 UTC.
Your challenge is to output a truthy value if SE is down/read only and a falsy value if SE is not. You may not have any input, and you must use date builtins to determine if SE is down/read only (no actually querying the SE api!) Example output:
1... |
I have trouble remembering everything I have to do when leveling up a D&D character. For whatever reason, one of the things that gives me trouble is figuring out what their new maximum HP value should be. For this challenge, you will write a program or function to calculate the correct value automatically.
Terminology
... |
Challenge
Given the high resolution molecular mass of an organic molecule, output the molecule's molecular formula.
Explanation
The input will be a single number to three decimal places of precision, the relative molecular mass of the molecule.
Here, the molecular mass is defined as the sum of the masses of the atoms i... |
Since tomorrow is the 4th of May, here's a little Star Wars themed post to prepare you mentally to all the bad jokes coming tomorrow.
BACKSTORY
During a session of the galactic senate all the senators are sitting in an n*n grid.
A sudden outbreak of JarJar flu (which lasts forever and causes the infected to speak like ... |
The task
Given any array of integers, e.g.:
[-1,476,578,27,0,1,-1,1,2]
and an index of that array (this example uses 0 based indexing, though you can use 1 based indexing as well.):
index = 5
v
[-1,476,578,27,0,1,-1,1,2]
Then return the nearest number greater than the element at that index. ... |
Write a program (or function) that exhibits four common big O time complexities depending on how it is run. In any form it takes in a positive integer N which you may assume is less than 231.
When the program is run in its original form it should have constant complexity. That is, the complexity should be Θ(1) or, equ... |
At runtime, keep prompting for a line of input until the user inputs something (other than an empty newline), i.e. does not just press Enter or OK. Output or result is neither required nor prohibited.
Pseudo-code 1
myform = new form("GUI")
myform.mytxt = new editfield("")
myform.ok = new button("OK")
repeat
waitfor(m... |
Task
Given a positive integer n, output n+1 if n is odd, and output n-1 if n is even.
Input
A positive integer. You may assume that the integer is within the handling capability of the language.
Output
A positive integer, specified above.
Testcases
input output
1 2
2 1
3 4
4 3
5 ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.