instruction stringlengths 34 53.1k |
|---|
ASCII reflections in a box
You probably all know the Law of Reflection, in this challenge you'll visualize the trajectory of a ball in a box.
Related: ASCII Ball in Box Animation and ASCII Doodling: Laser in a Box
Task
You're given three integer pairs W,H, x,y and dx,dy - the first represents the size of the box, the s... |
There are one hundred members of the United States Senate. Assuming that nobody filibusters and that the Vice President isn't cooperating, at least fifty-one members are necessary to pass a bill. But some members work together better than others, entropy-wise.
Your task: Output the last names of at least 51 of the US s... |
Given an array of positive integers, output an array of all the elements that are greater than or equal to the adjacent ones. Most elements will have two adjacent elements; the first and last element are special cases, as they only have one adjacent element.
You may assume that the array contains at least two elements.... |
For this challenge you are going to make a function (your function may be a complete program) that takes a list as input and returns a permutation of that list. Your function must obey the following requirements.
It must be deterministic.
Composing your function with itself a variable number of times should be capabl... |
Challenge closed, the shortest answer has been acccepted.
A military projection is a projection where all lengths and the angles in the X-Z plane remain unattuned.
Your task is to print a cube in military projection using /, |, \, -, and any whitespaces you want, given any integer greater than zero as it's side length.... |
You love lunch. However, you are on a diet and want to make sure you don't accidentally eat lunch twice in one day. So you need to make a program to help you make sure.
However, one complication is that you eat lunch on a very weird schedule. The time you eat lunch at is MONTH:DAY PM (you can use UTC or localized time ... |
It is widely known that Santa Claus delivers presents to houses all over the world in December. However, not many people know what he does during the rest of the year. You see, Santa enjoys a jolly good prank, and he'll often find himself pranking entire cities when he's not busy making or delivering toys.
One place t... |
Inspired from a real problem; we were looking at this table and said "Hey, now that's a good codegolf problem."
The KOOS Jr. scores converts from a raw number to a percentile score given this table:
Raw summed score Interval score
(0-28) (0 to 100 scale)
0 100.000
1 91.975
... |
You will be given a positive integer as input.
The integer is the board of a seesaw.
Th integer will not have leading zeroes. You may take this input however you like.
Your task is to output the location of the pivot point of this seesaw, such that the board would balance.
A board balances if the moments on each side a... |
Your task is to make a program that prints out its own source.
"Hey, we already have this challenge, and tons of variations of it! Why are you making another one?" you may ask, but this one is going to be one of the most difficult ones (hopefully, anyway).
Your quine must be "mutation-hardened", which means the quine, ... |
For the question Find the highest unique digit , here is my answer :
9A,sqfe=W%X#-
At the end I am essentially trying to achieve a lastIndexOf. I do that by reversing my array, using indexOf, and subtracting from 9. This adds 4 (9 W % -) extra bytes to get from indexOf to lastIndexOf.
Furthermore, if I didn't know my... |
Your task, if you wish to accept it, is to write a program that outputs a positive integer (higher than 0). The tricky part is that if I duplicate your source code, the output must be double the original integer.
Rules
You must build a full program. That is, your output has to be printed to STDOUT.
The initial source... |
This is a variant of Play the word chain and Building a long chain of words .
The input is a non-empty list of unique words at least 2 chars long made of characters in [a-z]. You need to output the length of the longest possible chain, where each subsequent word starts with the last letter of the previous word. You ca... |
Lets take a set of integers greater than 1 and call it X. We will define S(i) to be the set of all members of X divisible by i where i > 1. Would like to choose from these subsets a group of sets such that
Their union is the set X
No element of X is in two of the sets.
For example we can regroup {3..11} as
... |
You have given an array from which we need to remove duplicates.
Rules:
First or immediate duplicates gets removed first.
Array contains natural numbers a[i]>0 for i>=0
no. of elements in the array is greater than 1 i.e. n>1
e.g.
{1,2,3,4,5,5,4,6,6,7,8}=> {1,2,3,7,8}
{1,2,3,3,4,5,6,7,7,8} => {1,2,4,5,6,8}
{1,1,3,3,... |
Description
I guess everyone knows the fairy tale of Rapunzel and the prince. For those who do not: read it here. However, Rapunzel had just had her hair cut, so it might not be long enough to let her prince climb up! She may get very sad..
Challenge
Your task is to write a function that evaluates what Rapunzel will be... |
Inspired (like 2 others) by this chat message. (and to some extent, my CMC)
Given a string as an input, your task is to check whether or not that string is a number.
What is a number?
This is a list of all input formats that are "numbers":
Integers: An integer is a string made entirely of characters from 1234567890, w... |
The graph of the modulo operation (\$y = x \mod k\$) looks like this:
This is a very useful function, as it allows us to create "wrapping" behavior. However, it is very cumbersome when I want to use it to create an appearance of "bouncing" between two walls. The graph of the "bounce" function (\$y = \text{bounce} (x, ... |
Background
Sometimes, people think you didn't work at your git project. But - you can prove yourself with git shortlog -n. Now, the problem is you are a programmer and programmers are lazy. So you want to write a program which shows the person who committed at most.
Rules
You may not do the following things:
use git s... |
Don't you hate it when you can't remember how to craft something in Minecraft? Well, time to remedy that!
Task
Your task is to take an input, either as a 1D or 2D list and output what item is a result of the crafting table!
Input
You may take input as either a string or a list of length 9 or a 2D nested array.
If you t... |
Description
Chicken McNugget numbers are numbers that can be expressed as a sum of \$6\$, \$9\$ or \$20\$ - the initial sizes of the famous Chicken McNuggets boxes sold by McDonald's. In that sum, a number may occur more than once, so \$6 + 6 = 12\$ is such a number too, and the number must "contain" at least one of th... |
The RGB color value #00FF00 is a rather important one: it is used to make movies, TV shows, weather announcements, and more. It is the famous "TV green" or "green screen" color.
The Challenge
Your task is to write a program that takes two input images, both in PNG format (or in your image library's image object type) a... |
Inspiration:
Heavily inspired by Smallest chess board compression I decided to make a similar but distinctly different competition.
tl;dr
Take the file Chess_Games.txt and compress it as much as you can so that you can expand it to the original file.
Objective:
Write an algorithm to encode and decode an entire chess da... |
Your challenge is to output a Base64-encoded version of your source code, and optionally a line break. You must output the correct padding, if any. Standard quine rules apply, shortest answer wins.
It must be a valid RFC 4648 encoded base64 string, with no linebreaks (except optionally a trailing newline).
Test cases:
... |
From the wikipedia:
Net neutrality is the principle that Internet service providers and governments regulating the Internet should treat all data on the Internet the same, not discriminating or charging differentially by user, content, website, platform, application, type of attached equipment, or mode of communicatio... |
In this challenge you have to make an ascii pulsing heart with rhythm problems (Heart arrhythmia) and then measure the pulse.Don't worry it's easy!
Making the heart
The heart alternates between these 2 states:
state 1
,d88b.d88b,
88888888888
`Y8888888Y'
`Y888Y'
`Y'
state 2
d8b d8b
... |
If you are not familiar with Braid-Theory I recommend that you read this first. This question assumes that you are at least familiar with the concepts at hand and assumes you are well familiar with group-theory
Let us define \$\sigma_n\$ to be the braid in which the \$n\$th strand (One indexed) from the top crosses ... |
Guidelines
Task
Write a method that takes an array of consecutive (increasing) letters as input and that returns the missing letter in the array (lists in some languages).
Rules
This is code golf so the shortest answer in bytes wins!
You will always get a valid array
There will always be exactly one letter missing
Th... |
Based on this challenge.
In the rhythm game osu!, the difficulty modifier "Double-time" actually only increases the speed by 50%.
Your task, is to write a program that outputs a positive even integer (higher than 0), and when each byte/character (your choice which) in your source code is duplicated, it should output th... |
Description
There have been quite a few other challenges concerning these numbers before, and I hope this one is not among them.
The n th triangular number equals the sum of all natural numbers up to n, simple stuff. There are a wikipedia page and an entry at OEIS, for those who wish to inform themselves further.
Now, ... |
Help! I just logged into Stack Exchange, but I forgot what my password is! I need a way to work it out before I log off.
Luckily, I'm an excellent hacker. Not only was I able to find my password's hash, but I also found Stack Exchange's hashing algorithm! It takes the ASCII value of each digit multiplied by that digit... |
We define a prime character as a character that has a prime ASCII value. We define a prime string as a String that only contains prime characters.
Given a String that only contains printable ASCII, determine whether that String is prime.
Input / Output
You can take input either as a String or as a list of individual c... |
Let's see how good your language of choice is at selective randomness.
Given 4 characters, A, B, C, and D, or a string of 4 characters ABCD as input, output one of the characters with the following probabilities:
A should have a 1/8 (12.5%) chance to be chosen
B should have a 3/8 (37.5%) chance to be chosen
C should h... |
Challenge
Given an integer in 32-bit two's complement format, return the index of the second least-significant zero digit in the binary representation, where an index of 0 represents the least significant bit, and an index of 31 represents the most significant bit.
If there is no second zero, you may return 0, any nega... |
Description
We consider an integer with at least 3 digits triple-balanced if, when split into three parts, the digits in every part sum up to the same number. We split numbers as follows:
abcdefghi - Standard case: the number of digits is divisable through 3:
abc def ghi
abcdefgh - Number % 3 == 2: The outer groups ar... |
As we all know, it's turtles all the way down. But is it primes all the way down too?
A number is considered a "turtle-prime" if it satisfies the following conditions:
1) It is prime.
2) It is possible to remove a single digit leaving a prime number.
3) Step 2 can be repeated until left with a single digit prime.
For ... |
Many of us are familiar with the game Tron. You control a "lightcycle" placed on a grid. The lightcycle always moves forward (though you control the direction) and leaves a permanent trail behind it. If you run into a trail, you crash!
The goal here is to determine if a given path is a valid loop, that is, it returns t... |
I noticed that there's no such question, so here it is:
Do you have general tips for golfing in x86/x64 machine code? If the tip only applies to a certain environment or calling convention, please specify that in your answer.
Please only one tip per answer (see here).
|
One problem on a website like this is that you often don't know if you are talking to a male or female. However, you have come up with a simple NLP technique you can use to determine the gender of the writer of a piece of text.
Theory
About 38.1% of letters used in English are vowels [a,e,i,o,u] (see References below, ... |
Given a non-negative integer or a list of digits, determine in how many ways can the number be formed by concatenating square numbers, which may have leading zeroes.
Examples
input -> output # explanation
164 -> 2 # [16, 4], [1, 64]
101 -> 2 # [1, 01], [1, 0, 1]
100 -> 3 # [100], [1, 00], [1, 0, 0]
1 -> 1 # [1]
0 -> 1 ... |
The infinity symbol is also called a lemniscate. Your program must draw a lemniscate with text via standard out (formatted with newline feeds) or graphically.
The infinity symbol (by my standards) must be continuous (that is, every non-whitespace character must be touching two other non-whitespace characters diagonally... |
Problem
Given input a where a is a grid of characters in any input format as long as it has only one element for each 'block' of the output.
And input b where b is a grid of numbers the same size as input a.
There are two types of road, a 1 represents a stone road marked by @ and a 2 represents a dirt road marked by #
... |
Description
A Caesar Shift is a very simple monoalphabetic cipher where each letter gets replaced by the one after it in the alphabet. Example:
Hello world! -> IFMMP XPSME!
(IBSLR, EGUFV! is the output for the actual challenge, this was an example of shifting by 1.)
As you can see, spacing and punctuation remain unatt... |
Drunk Uncle (sorry M.E. and AUS for region lock) is a fictional character from Saturday Night Live. He often confuses words for others that sound like them. For this challenge you need to convert normal speech into drunkspeak.
Algorithm
Translating to drunkspeak requires swapping the order of words in the text. Swappin... |
There is a Sioux village. It has a totem:
__
___| |___
\/ \ / \/
/\ ``| |`` /\
/^^\ | | /^^\
/ /\ \ | | / /\ \
''''''''''''''''''''''''''''
The totem lets the Sioux mastering the weather for helping in their different tasks. Help the villagers p... |
I'm honestly surprised that this hasn't been done already. If you can find an existing thread, by all means mark this as a duplicate or let me know.
Input
Your input is in the form of any positive integer greater than or equal to 1.
Output
You must output the sum of all integers between and including 1 and the number i... |
These are the hosts of the "Weekend Update" news segment on Saturday Night Live, with the years they hosted and their initials:
Chevy Chase 1975-1976 CC
Jane Curtain 1976-1980 JC
Dan Aykroyd 1977-1978 DA
Bill Murray 1978-1980 BM
Charles Rocket 1980-1981 CR
Gail Matthius 19... |
To "shift" over a number n places, do the following:
Remove the last n digits
Add n copies of the first digit to the beginning of the number
For example, to shift the number 31415 three places, take out the last three digits to get 31, and then add three more copies of the first digit, 3, to the end, giving 33331.
If... |
This is a tips question for golfing in Python, which is on topic for main.
I'm looking for the shortest way to get all of the most common elements of a list in Python, in the shortest way possible. Here's what I've tried, assuming the list is in a variable called l:
from statistics import*
mode(l)
This throws an error... |
Inspired by this comment...
Thanks to users Step Hen, Wheat-Wizard, and Dennis for helping my solidify the specification of this challenge before posting it!
This is the Cops' thread. For the Robbers' thread, go here
In this challenge, you are tasked with running some code that makes it so that your language no longer... |
Inspired by this comment...
Thanks to users Step Hen, Wheat-Wizard, and Dennis for helping my solidify the specification of this challenge before posting it!
This is the Robber's thread! For the Cops' thread, go here
In this challenge, you are tasked with running some code that makes it so that your language no longer... |
Introduction
Classically, booleans are one bit; true or false, 1 or 0. Leading zeros would just be redundant. For example, 001 means the same as 00001 or just 1.
The 32-bit boolean
Given a truthy/falsey value, output the equivalent 32-bit boolean as a string.
(Or as a number if for some reason your language supports l... |
Simple challenge: try to output the following text in as few bytes as you can:
the answer
toli fetheuniv
ersea nde ver
ything the ans
wer tol ife the
uni ver sean
dev ery thin
gth ean swer
tolifetheuni ver
seandeveryth in... |
Problem
Build an octal calculator that can do the following operations:
Add (+)
Subtract (-)
Multiply (*)
Divide (/)
Check is prime
Counting in octal is like this with decimal
(Octal) (Decimal)
0 0
1 1
2 2
3 3
4 4
5 5
6 6
7 7
10 8
11 9
and so on..... |
I need to call my friends but the buttons of my cordless phone are not working properly. The only buttons I can press are [Up], [Down] and [Call]. [Up] and [Down] can be used to navigate in my recent calls and [Call] can be used to call the selected name. My phone has a list that holds N recent calls, and I know that a... |
We are all familiar with the famous Fibonacci sequence, that starts with 0 and 1, and each element is the sum of the previous two. Here are the first few terms (OEIS A000045):
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, 233, 377, 610, 987, 1597, 2584
Given a positive integer, return the closest number of the Fibona... |
Basic rules (different from mine)
Story
It is the year 4579, humans now have 2 hands with 1001 fingers each. Chopsticks has become based off of points. And @Dennis has more rep then @Martin... Hand drawn red circles are now downvoted... Jon Skeet has hit 2 trillion rep on every SE site... Yeah scary I know
Chopsticks i... |
(based on this post and the ensuing discussion on chat -- also, much thanks to Dennis for TIO!)
The Challenge
Choose a language that's currently available on the TryItOnline site, for example PowerShell. Write code in that language on that page, that doesn't take any input, such that when the Run button is clicked, the... |
Let's say you have some text, and you want it to send it to your friend, but you don't want anyone else to read it. That probably means you want to encrypt it so that only you and your friend can read it. But, there is a problem: you and your friend forgot to agree on an encryption method, so if you send them a messa... |
Description:
A non-integer representation of a number uses non-integer numbers as the bases of a positional numbering system.
e.g. Using the golden ratio (the irrational number 1 + √5/2 ≈ 1.61803399 symbolized by the Greek letter φ) as its base, the numbers 1 to 10 can be written:
Decimal Powers of φ Base φ... |
Challenge
Take a number and output it with 4 digits or less using letters and numbers. For example; 270,030 would turn into 270K.
Key
Billion -> B
Million -> M
Thousand -> K
Rules
You may choose to accept input numbers that include commas delimiting every three decimal places (such as 123,456,789).
Round to nearest, h... |
The challenge is to find a string of characters that cannot appear in any legal program in your programming language of choice. That includes comments, strings, or other "non-executable" parts.
Challenge
Your program may be specific to a particular version or implementation of your language's compiler/interpreter/runt... |
Goal
Given an input number, round it off to the nearest number with one significant figure.
Requirements
Input
A floating point number.
Assume the input number results in an output within the data type's limits (ie. ignore overflow errors.)
0 is an invalid input.
Numbers that cannot be accurately represented in the fl... |
Write a function that takes a string of letters and spaces (no need to handle non-letters) and performs the ANNOUNCER VOICE translation algorithm as follows:
First, uppercase everything.
For each word,
Elongate each consonant cluster by tripling each letter; except, if the word begins with a consonant cluster, do no... |
Using the following length-separated lists of words:
https://github.com/Magic Octopus Urn/wordListsByLength
Print 1 word from each list of length n from 1 all the way up to 20, here's a valid example:
a
an
and
hand
hands
handle
handles
abandons
abandoned
understand
outstanding
newfoundland
understanding
characteristic... |
Let's say we have a n × n lattice; we can then divide the lattice into two sections by drawing a line through the lattice. Everything to one side of the line is in one set and everything else in another.
How many ways can we divide the lattice in the manner?
For example lets take a 2 × 2 lattice:
. .
. .
We can make ... |
Thanks to HyperNeutrino for making more test cases
Often in chat, someone will ask a question, and multiple people will answer it at the same time. Usually, the person who was beaten to the gun will say "ninja'd", creating even more unnecessary chat.
Given a chat log similar to the following:
Community: Hi
Test: Hi
Ran... |
According to me, a tornado looks like this:
########
#######
######
#####
####
###
##
#
This tornado starts out with width n, and on each next line, a character is removed from either the left or the right, depending on the input.
Input
The input will be a list of some sort of any two unique values (... |
There have been a billion iterations of Fibonacci challenges on this website, so lets spice things up with a Fibonacci challenge of a billion iterations!
Your challenge is to output the first 1000 decimal digits of the 1,000,000,000th Fibonacci number with as short a program as possible. This may then optionally be fol... |
In my answer, I have this code:
s.match(/[AEIOU]/)
This seems too verbose to check if a string is one of A, E, I, O, or U.
I tried:
"AEIOU".includes(s)
But that's 1 byte longer. Can I do this in a shorter way?
|
Imagine a straight river and a road that goes across the river n times through bridges. The road does not loop on itself and is infinitely long. This road would be considered an open meander. An open meander is an open curve, that does not intersect itself and extends infinitely at both ends, which intersects a line n ... |
The Challenge
Your task is to create a program that takes any given string input, and outputs the input in a squared format. Empty strings should return an empty string.
Examples
Given the input:
golf
Your program should output:
golf
o l
l o
flog
Input:
123
Output:
123
2 2
321
Input:
a
Output:
a
Input:
Hello, w... |
No, not that thing in powerpoint
You will be given a string, and a 2D array of boolean values. The 2D array will represent a picture.
You will be creating art out of it.
Let me show you how.
The steps to art
First, you create a square which fits the 2d array, with the string.
Like if the string is 'PPCG', and the pic... |
This is similar to Making an acronym, but there are several key differences, including the method of fetching the acronym, and this challenge including flexible output.
Task
Given a string (list of chars/length 1 strings is allowed) containing only printable ASCII, output all capital letters in the input that are eithe... |
(Despite 60+ questions tagged chess, we don't have a simple n-queens challenge.)
In chess, the N-Queens Puzzle is described as follows: Given an n x n chessboard and n queens, arrange the queens onto the chessboard so that no two queens are threatening each other. Below is an example solution for n = 8, borrowed from W... |
Let us define a sequence. We will say that \$a(n)\$ is the smallest number, \$x\$, that has the following properties:
\$x\$ and \$n\$ are co-prime (they share no factor)
\$x\$ does not appear earlier in the sequence
\$|n - x| > 1\$
Unlike most sequences the domain and range of our sequence are the integers greater t... |
As of 13/03/2018 16:45 UTC, the winner is answer #345, by Khuldraeseth na'Barya. This means the contest is officially over, but feel free to continue posting answers, just so long as they follow the rules.
As well, just a quick shout out to the top three answerers in terms of numbers of answers:
1. NieDzejkob - 41 ans... |
Inspired by this challenge (thanks @cairdcoinheringaahing for the title!), your task is to take two printable ASCII strings and multiply them element-wise with the following rules.
How does it work?
Given two strings (for example split and isbn) you will first, truncate the longer one such that they have equal length a... |
Cubically is too tedious to manually write any code in. Your challenge is to translate ASCII text into Cubically source code.
Cubically
This is just a quick run-down of Cubically; the repository has a more complete guide and details.
Cubically is an esolang I wrote a while ago, designed to be painful to use. It contain... |
Given an integer n ≥ 1, output a 2D representation† of a percent sign of width n. The construction goes as follows:
Create an n by n matrix (or list of lists) filled with zeroes.
Insert ones in the top-left and bottom-right corners.
Place ones on the diagonal from the bottom-left to the top-right.
For input n = 4, th... |
Challenge
Write the shortest program that, when compiled or executed, produces a fatal error message smaller than the program itself. The error message may not be generated by the program itself, such as Python's raise. A valid answer must include both the code and the error message. Shortest valid answer wins.
No erro... |
Challenge
Given a list of integers, return the list of these integers after repeatedly removing all pairs of adjacent equal items.
Note that if you have an odd-length run of equal numbers, one of them will remain, not being part of a pair.
Example:
[0, 0, 0, 1, 2, 4, 4, 2, 1, 1, 0]
First, you should remove 0, 0, 4, 4,... |
This challenge is as follows.
(Uhoh no! Now everyone is going to use reciprocal division. Now all the answers are going to look the same and lose originality, ugh!)
Given two integers multiply them, ... but you can't use the multiplication symbols "*" and "x". As you probably know multiplication is just an extension... |
A curve is a set of points on a square grid such that each point has exactly two neighbors in the four-neighbor neighborhood and the points form a single connected component. That is, the graph induced by the points on a grid graph is isomorphic to a single cycle. "Induced" means that two points cannot touch in the inp... |
This challenge is pretty simple: Your task is to draw a schematic of a (simplified) memory array. You will be given two (positive) integers n,m and the task is to draw the n:2^n decoder connected to the memory array with d data lines.
The addressing will be in the order of gray codes, to check if the sequence is correc... |
For this challenge you need to make a given word by concatenating "pieces" (a.k.a contiguous substrings) from other words. Given a word and a list of words as input, output the fewest number of pieces needed to create the first word.
Rules
Words consist of characters in the ASCII range 33 to 126.
The word list may ha... |
Given a single positive odd integer as input, return a converging zigzag as a list of strings, list of lists of characters, or newline-separated string, in this form:
#
#
#
#
#
#
#
#
#
#
#
You can replace # with any consistent non-whitespace character. Trailing whitespace on each line is allowed... |
You will be given a String consisting of printable ASCII (without newlines). Your task is to build a nice Stairway for my Castle.
How to build a nice Stairway?
First off, you should get all the rotations of the String. For example, the String abcd has the following rotations: abcd, bcda, cdab, dabc (each character is ... |
Given a string containing only letters (case-insensitive), split it into words of uniformly random lengths, using the distribution below, with the exception of the last word, which can be of any valid length (1-10). Your output is these words, as a space-separated string ("test te tests"), an array of strings (["test",... |
Watch live | Active answers | Add new answer | Chat room | Source code | Leaderboard
New tournaments whenever needed. New players and new updates very welcome.
Not actual game footage.
Each player starts with one ant - a queen, who collects food. Each piece of food can be held or used to produce a worker. Workers also... |
Lets define a class of functions. These functions will map from the positive integers to the positive integers and must satisfy the following requirements:
The function must be Bijective, meaning that every value maps to and is mapped to by exactly one value.
You must be able to get from any positive integer to any o... |
Your task today is to apply a wave to an array of numbers. A wave looks like this: [1, 0, -1, 0, 1, 0, -1, 0, 1...] Applying it to a given array means adding together the first elements, the second elements, etc.
More precisely:
Your program or function will receive an array of integers. It must print or return an equa... |
A Sphenic Number is a number that is the product of exactly three distinct primes. The first few Sphenic numbers are 30, 42, 66, 70, 78, 102, 105, 110, 114. This is sequence A007304 in the OEIS.
Your Task:
Write a program or function to determine whether an inputted integer is a Sphenic number.
Input:
An integer be... |
Challenge
Given a set T of subsets of a finite set S={1,2,3,...,n}, determine whether T is a topology or not.
Explanation
The powerset P(S) of some set S is the set of all subsets of S. Some examples:
S = {}, P(S) = {{}}
S = {1}, P(S) = {{}, {1}}
S = {1,2}, P(S) = {{}, {1}, {2}, {1,2}}
S = {1,2,3}, P(S) = {{}, {1}, {2}... |
You and your friend want to send each other secret messages. However, because you are conspiracy theorists and think that the government has a quantum computer that can crack any standard encryption. Therefore, you are inventing one of your own. The first step of this is as follows: taking an input string, you check... |
Input:
A non-empty list / vector where each element holds a value/character, indicating if you'll count up or down. I'll use 1 and -1, but you may choose whatever you like. You can only use two values, you can't use 1,2,3... and -1,-2,-3..., for up and down respectively.
Challenge:
You'll use the numbers in the geomet... |
Challenge
HP is doing research in mathematics . After doing lots of research, she struck in a problem . She found four numbers n,a, b and c .Now, She wants to know how many number exists which are less than or equal to n and are divisible by a ,b or c .
Input :
4 integers denoting n,a,b and c separated by space
Output ... |
An Integer is prime if and only if it is positive and has exactly 2 distinct divisors: 1 and itself. A twin prime pair is made of two elements: p and p±2, that are both prime.
You will be given a positive integer as input. Your task is to return a truthy / falsy depending on whether the given integer belongs to a twin ... |
Last Thursday user @SpookyGengar delighted us with his/her first challenge about Making Squared Words. What if we double the number of sides?
The challenge
Take a string as input in any reasonable format you need (string, char array...) and output an octogonal representation of the input (also in any reasonable format:... |
Given an array of positive integers in base 10, where n > 0, output their representation of a binary wall.
How does this work?
Convert each number to its binary representation.
Pad the representation with leading zeroes to the length of the longest one i.e. 1, 2 -> 1, 10 -> 01, 10.
Create a wall where the 1s are brick... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.