instruction
stringlengths
34
53.1k
We define a binarray as an array satisfying the following properties: it's non-empty the first value is a 1 the last value is a 1 all other values are either 0 or 1 For instance, the array [ 1, 1, 0, 1 ] is a valid binarray. The task Given a non-empty array A of non-negative integers and a positive integer N, your jo...
(There are related questions about infinite sandpiles, and finding identity elements of sandpiles.) Given a matrix of non-negative integers, return a matrix of the same dimensions, but toppled: If the matrix doesn't contain any values larger than 4, return it. Every "cell" that is larger than 3 gets reduced by 4, and ...
The sound of the theremin has been immortalized in The Beach Boys song Good Vibrations. Many also associate its sound with the theme for the original series of Star Trek, though apparently it was a soprano's emulation. This challenge requires you to implement a theremin. Input Take 2 dimensional input from a mouse or...
Note: There was not a vanilla challenge to actually flip a coin, even though there were mentions about flipping coins a lot of places. Even though there is a challenge to generate a random number from 1 to N, I suspect this is not a dupe. These questions ask for random numbers from 1 to N, while this ask for just trut...
Challenge Given a (floating-point/decimal) number, return its reciprocal, i.e. 1 divided by the number. The output must be a floating-point/decimal number, not just an integer. Detailed specification You must receive input in the form of a floating-point/decimal number... ...which has at least 4 significant digits o...
A fun game to play if you are bored is the Diffy Game. It is a one player game that is pretty simple and can consume a good deal of your time. The Diffy game works like as follows: You start with a list of non-negative integers, in this example we will use 3 4 5 8 Then you take the absolute difference between adjacen...
The user will hide, and the computer will try to find them. First, the program will take an input, for the size of the grid. Like 5x5, 10x10, 15x15, etc. The grid won't always be a perfect square. The grid is sort of like a chessboard: _______________________________ | | | | | | | A1 | | | ...
Usually to run multiple commands consecutively one would do: sudo apt update && sudo apt upgrade # 35 characters I can't help but feel there's a neat trick to running these with less keystrokes, and you golfers here love challenges :) I've found a ton of answers around various SE Sites related to running arguments to ...
Task Everyone knows the game "Tic-Tac-Toe". Your task is it, to evaluate an ascii tic-tac-toe matchfield. Your Programm/Function should output/return the winner: O, X or nobody (N). Pattern X|O|X O|X|O O|O|X In this case your programm/function should output/return 'X' Rules Input can come from STDIN, function argumen...
This is a fairly simple challenge. Write a program that computes the distance between two points on a 2D plane. However, you can't use any functions or operators (referred to here as symbols) that are 1 character long. Examples: -=, +=, *=, /=, %=, etc. are allowed. ||, &&, --, ++ are allowed as well. +, -, /, * are n...
Your challenge is to print/output/return this text: _____ _____ | 1 | | 2 | | H | ...
Today, as I'm writing this, is March 31st. In the US, this is 3/31. I was playing around with 331 as a number to come up with a challenge, and found that its residues (modulo small numbers) is palindromic. 331%2=1, 331%3=1, 331%4=3, 331%5=1, 331%6=1 (11311). Your challenge here is, when given an integer n > 2, output t...
Because it's Saturday (UTC) and I'm hungry, I would like a slice of pizza. I will give you an order and I would like a nice hot ascii-art pizza. Up to the challenge? The Drive-Thru I'll place my order wherever your drive-thru is, whether it is STDIN, a function parameter, a command-line argument, but I'm not going to p...
Each March in the United States, the NCAA holds a 68-team tournament for both men's and women's college basketball. Here's what the bracket looks like: There are four regions, each with 16 teams seeded from 1-16. Each region is seeded the same way, and across the four regions, the same matchups occur between seeds. Fo...
In this challenge, you'll get four different but somewhat related tasks that must be solved in a specific manner. First, I'll explain the tasks, then follows an explanation of how you must solve it. Your code should for all four tasks take two positive integers as input: n,m, where n<m. All tasks must be solved in the ...
Challenge Given two numbers, output their quotient. In other words, integer divide one number by another. Both divisor/dividend will be under 10001. Division must be performed using integer division, rounding down. Here are some example inputs and outputs: 5 1 5 -4 2 -2 4 -2 -2 6 ...
To-Do: Come up with a Better Title Specification: This challenge is similar to kolmogorov-complexity, but with a twist. You goal is to output a finite string that resembles the following string of psuedo-random characters as closely as possible: BABBBBAAABBAABBBBAABBBAABBBABBAABABABBBBABBBBBBAABABBAABABBBABBBABAAAAABA...
Given a string of ASCII art like such (This isn't ASCII art but it will do for the example): abc d e fgh Jumble it as if it was being displayed on a screen with one character per line, like so: a b c d e f g h Print the result, wait one second, ±0.5 seconds before clearing the terminal and the print the same thing, ...
Introduction A queue is an abstract data type where elements are added to the front (enqueue) and removed from the back (dequeue). This is also known as the FIFO (First In First Out) principle. It is best shown with an example: Challenge Given a non-empty array that contains positive integers and elements that indica...
On most new-years challenges when it is currently not the corresponding year of the challenge, It says this in the front. It's [current year] already, folks, go home. You have to output this text with the current year substituted. I/O Input: None. Output: It's [current year] already, folks, go home.
Very few, if any, programs or applications have utilised the proposed spec for WOM which was initially thought up in the early 1970s as a polar opposite to ROM, so your task is to take a dataset of n Integers and simulate storing it to a WOM schema as a proof of concept. Your array must contain 1 or more integers. Smal...
Chess is a game with 6 different types of pieces that can move in different ways: Pawns - They can only move up or capture diagonally (also forward). Capturing a piece behind them or beside them is illegal. The only exception is en passant. For this challenge, if a pawn reaches the 8th rank (or row), assume it become...
Note to Moderators and editors: This post's title is for effect and should not be changed. The misspelling is intentional and part of the challenge. Backstory The (stereo)typical bad SO question asks something along the lines of "plz send teh codez!" In other words, it asks someone to do the work for the asker and ...
Introduction You may know and love your normal unit circle. But mathematicans are crazy and thus they have abstracted the concept to any point that satisfies x*x+y*y=1. Because Cryptographers1 are also weird, they love finite fields and sometimes finite rings (it is not like they have much choice though), so let's comb...
Input: a sequence of uppercase letters (ASCII [65;90]) which is the Nth* lexicographical permutation of the multiset of its characters *permutations are numbered from 0 or 1 upwards Output: base-10 integer N Rulez There might be duplicates (that's how this challenge differs from this one) The characters are ordered b...
Your challenge is simple: write a program or function which appears to print the first ten numbers of any integer sequence (on OEIS, the answerer may choose which sequence), but instead prints the exact text: Happy April Fool's Day! if and only if it is run on April 1st of any year. Run on any other day should make it...
Note: The winning answer will be selected on 4/12/17 the current winner is Jolf, 1 byte. I'm surprised that we haven't had a what's my middle name challenge on this site yet. I did alot of searching but found nothing. If this is a dup, please flag it as such. Your challenge Parse a string that looks like Jo Jean Smit...
In this challenge we try to solve two important problems at once. They are: Given integers \$a\$ and \$b\$, tell if \$a^b-1\$ is a prime number. Given integers \$a\$ and \$b\$, return \$a\choose b\$. Specifically, you must write two programs, one that does the first task and one that does the other. As we want to sol...
The pigeonhole principle states that If N items are put into M boxes, with N > M, then at least one box must contain more than one item. For many, this principle has a special status compared to other mathematical enouncements. As E.W. Dijkstra wrote, It is surrounded by some mystique. Proofs using it are often rega...
Well, Brexit happened. And Sky News, being the geniuses they are, have decided to create a countdown on the side of a bus. Your job is to do something similar. The UK leaves the the EU on 31st of March 2019 and you have to create a digital countdown for this that changes every second (with a 0.05 second deviation allo...
Input: 2 numbers, x and y. Output: Output a text block where x is the width of the text block and y is the height of the text block. Then there will be a straight line going from the top left to the bottom right and to show it, there should be a # where the line should cross. The # should be generated using the straigh...
Perfect License Plates Starting a few years ago, I made myself a little game while driving around: checking if nearby license plates are "perfect". It's relatively rare, but exciting when you find one. To check if a license plate is perfect: Sum up the characters, with A = 1, B = 2, ... Z = 26. Take each consecutive...
Challenge: Output the 'integer-digits' of one of the following six arithmetic-tables based on the input: - addition (+); - subtraction (-); - multiplication (*); - division (/); - exponentiation (^); - modulo operation (%). Rules: What do I define as 'integer-digits': Every result of the arithmetic operand which is ex...
Task: Crack the scrambled code for multiplying the square root of an integer n by the square of it! You must post a comment in the cops' thread with a link to your working source, mentioning clearly that you have Cracked it. In your answer's title, you must include the link to the original answer. Rules: You may only ...
Note: This is the cops' thread, where one should post the scrambled code. Here is the robbers' thread where the cracked source should be posted and linked to the cop's answer. Task: Write the shortest safe program which multiplies the square root of an integer n by the square of n This is cops-and-robbers, so the rule...
Am I under Budget? Every 2 weeks when I get my cheque, I allocate a certain amount to last me until my next cheque, and bank the rest. To figure out how much I can spend per day and still remain under/on budget, I just need to divide the allocated amount by the number of days it needs to last me. On Day 1 if the budget...
I need this down to as few characters as possible. I would use Test-NetConnection but I need PSv2 compatability. Any help would be appreciated. $socket = new-object Net.Sockets.TcpClient $socket.Connect("192.168.5.5",445) $socket.Connected As a note I have tried this but it doesn't work (new-object Net.Sockets.TcpCl...
Piet is an interesting programming language for a number of reasons. Today we will focus on one reason: the roll command. The roll command was originally from PostScript and is a powerful way to manipulate the stack. The roll command pops the top two elements of the stack and uses them as parameters. We'll call the fir...
On the advice of Ms. Pac-Man who's worried about him getting overweight, Pac-Man has decided to keep track of his daily Pac-Dot intake. Help him count the number of Pac-Dots on a given path in the maze! The maze To help you build your own encoding of the maze, you can get some raw data here. Pac-Man's journey In the c...
Did you notice, that this is a palindrome? Input Non-negative integer number or string representing it Output 4 possible outputs, representing two properties of number: is it palindrome tricky #2 Tricky #2 property If number is not palindrome, this property answers the question "Do the first and the last digits have...
Task Read in a possibly infinite text stream or file, outputting its contents until the word hello has been output, abiding to the following rules. Once hello has been output, your code should quit immediately. It should not wait for a newline for example. Your code should output as it goes. That is it shouldn't read ...
The Manhattan distance on a regular grid is the number of orthogonal steps one needs to take to reach one cell from another. Orthogonal steps are those that go through the edges of the grid cells (as opposed to the corners, which would give us the Chebyshev distance). We can define a similar distance on other grids, fo...
Alice, Bob, Carol, Dave, and Eve are going out for a nice game of golf and need your help to decide in what order they will play. Your program will input some statements, which are defined as a condition, and then one or more optional logical boolean operators followed by another condition. (That's [Condition]([Logical...
Introduction It was just a normal day, here at your military base. Suddenly, you looked up to see a bomb falling down from the sky! You need to create a program to predict where it will fall, and tell you the location. Challenge You will be given a bomb in the form of Start-X Start-Y X-velocity Y-velocity. You can assu...
Background The language BrainF*** (or simply BF), is an extremely minimal programming language. We're going to strip it back even further by eliminating IO operations; only the sub-langage defined by the operations +-<>[], henceforth referred to as BF-subset, shall be used. The BF variant considered has a tape extendin...
Example run added 4/11 Rules Clarification 4/8: All submissions will be competing in one giant free-for-all tournament consisting of as many matches as my computer can perform in 48 hours. Anyone who's spent any time watching streams on Twitch is aware of the prevalence of DeepBot, and is perhaps even familiar with its...
Sometimes I find myself wanting a hot dog (don't we all) and so I make one. Now to make a hot dog, it is very simple. 1) Put the hot dogs into boiling water 2) Wait for a certain amount of time (detailed below) 3) Eat the hot dog once the time has elapsed. You may have noticed that I said certain time (detailed below...
Given two permutations in disjoint cycle form, output their product/composition in disjoint cycle form. To find the composition, convert the disjoint cycles to permutations in two-line notation. Each number in a disjoint part of a cycle is mapped to the number following it in the same part. It wraps around. So 1 -> 5,...
The dealer has been sloppy and lost track of what cards his/her deck contains and what cards are missing, can you help him/her? A complete deck consists of 52 playing cards, namely: Each color in the deck (hearts, diamonds, spades, clubs) contains: The numbers [2 - 10] A Jack A Queen A King An Ace Task Your program...
Disclaimer: This isn't my challenge but ThisGuy said I was OK to post. Occasionally I want to make a word into it's opposite, like happiness goes to unhappiness. Unfortunately when this happens, my brain will sometimes go blank. Then one day, after yet another this happening, I thought to my self "This is what program...
Introduction One day, you were just relaxing in your office in the CIA, when suddenly you see an alert on your computer. Your programs have just intercepted hundreds of coded messages! A quick examination reveals the rule for encoding, but you need a program in order to decode fast. Challenge You will be given a list...
Challenge: There's a silly puzzle circulating on social networks that reads: 8 + 2 = 16106 5 + 4 = 2091 9 + 6 = ? Implement a function or operator that, when given two positive integer numbers x and y such that x > y > 0, yields the correct answer as an integer, where the answer's digits are the digits of x * y follow...
April 5th is National Deep DIsh Pizza Day, the theme of this challenge. Given a positive integer n (n is greater than 0), create an ASCII deep dish pizza. Actual deep dish pizza shown: As you can see, there is a layer of crust on the bottom and surrounding the rest of the pizza. How to make the pizza The crust is mad...
Your Challenge You must write a program/function etc. that takes a domain name of a StackExchange site and outputs the domain for the meta version of the site passed to it. Examples: stackoverflow.com => meta.stackoverflow.com codegolf.stackexchange.com => codegolf.meta.stackexchange.com mathoverflow.net => meta.mathov...
It is common to start countdowns 100 days prior to an event, probably because of our base 10 system. Examples of this can be found everywhere: 100 days until your birthday 100 days until the wedding 100 days until the election 100 days until our graduation 100 days until her due date 100 days until football season 100...
Purpose The idea is to provide the code necessary to map a 32-bit integer to/from a pronouncable word of 9 characters maximum. That could be useful, for example, to make a serial number easier to remember, or type in a form. Both the method for translating an integer to the corresponding word and for translating back a...
For this challenge you need to implement two functions, f and g, on the integers, such that f ∘ g is a strictly decreasing function while g ∘ f is a strictly increasing function. In other words, if you take any two integers a < b, then f(g(a)) > f(g(b)) and g(f(a)) < g(f(b)). There are no restrictions on f and g indivi...
There are clever ways of determining whether a number is a power of 2. That's no longer an interesting problem, so let's determine whether a given integer is an integer power of -2. For example: -2 => yes: (-2)¹ -1 => no 0 => no 1 => yes: (-2)⁰ 2 => no 3 => no 4 => yes: (-2)² Rules You may write a program or a func...
A quine is a program that produces output that's identical to the program's source code. On this website, we generally only care about proper quines (at the time of writing, the current definition is "some part of the output is encoded by a different part of the program"). What advice do you have for writing proper qui...
This is a version of the recent challenge Is this number an integer power of -2? with a different set of criteria designed to highlight the interesting nature of the problem and make the challenge more difficult. I put some consideration into it here. The challenge as wonderfully stated by Toby in the linked question, ...
Backstory Not really real, sshh! It all started one day when a coworker brought in a homemade loaf of bread for my boss's birthday. My boss really liked this loaf of bread, and he wanted another. Unfortunately, my coworker has quit, so my boss needs me to give him another loaf. The problem is, I have no idea how to mak...
It's a funny accident that this world happens to have just 1 time dimension, but it doesn't have to be like that. It's easy to imagine worlds with 2 or more time dimensions, and in those worlds you could build computers and run software on them, just like in this one. The System Here is a system for running Brainf*ck p...
(Inspired by ASCII's 95 Characters...95 Movie Quotes) The Challenge Given input n, output the nth Fibonacci number. You can use either 0 or 1 indexing, please state which in your submission. Simple, yeah? The catch is you must take the character set of the immediate previous answer, remove two characters from it, and a...
Note: This challenge only allows answers in compiled languages Task Your task is pretty simple, make two different programs that when compiled result in the same output. Scoring Here is where the fun comes in. Your score will be the number of unique bytes present in exactly one program. For example if your two progra...
This question is inspired by this one Your task Make a program or function that calculates the Tetration of 2 numbers. Tetration is what "comes next after addition, multiplication, and exponents". For example, passing in 3 and 3, this is calculated: 3 ^ (3 ^ 3) yielding this: 7625597484987 Simple, right? WRONG. Rule...
The Problem: This challenge comes from a real problem I was having. I have a dual monitor setup at work, and I wanted to use the following image as my wallpaper: However, my monitors have quite significant bezels, and when I set my background, it looks something like this, where the pier appears (appiers?) to be broke...
Literally! April 6th is National Teflon Day, which is celebrated with Teflon-coated pans (what we will be making). So, given a positive integer n, create a Teflon pan. The "pan" section of the pan is an octagon with each of its sides consisting of n characters, which will vary depending on which side it is except for t...
I'm trying to strip down my python code to be as few lines as possible. The task: count how many square numbers are below 100. Here's my code so far: m = 0 for x in range(0, 100): m+=1-(-((-((x+1)**(0.5)-((x+1)**(0.5))//1))//1)); print(m) That addition statement adds 1 to m (the counter) only when (x+1) is a perfe...
Inspired by Golf me an ASCII Alphabet, of which this challenge is (almost) a direct inverse. Task: Take a string of ASCII-art text and output the content of the text as regular ASCII text. Input: String of ASCII-art text. Input will only contain instances of ASCII character #, spaces and 4 or 5 newlines (a trailing n...
In this challenge, your task is to decipher a string. Luckily, the algorithm is pretty simple: reading from left to right, each encountered digit N (0 to 9) must be replaced with the character which is N+1 positions before it. Example The input string "Prog2am0in6" would be decoded this way: Hence, the expected output...
Your task: given an integer n, generate an embedded hexagon pattern following the below rules, to the nth depth. An embedded hexagon has the basic shape of this: (n=0) __ / \ \__/ Embedded Hexagons n=1 and n=2: ____ / \ \ /\__/ \ \ / \____/ ________ / \ \ \ /\__/ \ \ /\ ...
This is the inverse of Let's do some "deciph4r4ng" In this challenge, your task is to encipher a string. Luckily, the algorithm is pretty simple: reading from left to right, each typical writing character (ASCII range 32-126) must be replaced by a number N (0-9) to indicate that it is the same as the character N+1 pos...
yOu wiLl bE giVen A sTriNg wHich cOnsiSts oF pRintAble asCii cHarActErs. yOu iTeraTe tHrougH thE sTrIng tHen chAnge rAndOM(uNifoRm, 50% cHanCe uPPercAse) lEtteRs to uPPercAse aNd eVerytHing elSe tO lOwercAse. tHat'S iT. (sorry for the punctuation, it was for the concept of the question) Readable version: You wi...
Note: This is inspired by this question by @Willbeing where task was to count the number of perfect plates of a certain length, but it's slightly different. We call a perfect licence plate that plate whose text satisfies the following conditions: It consists of characters, which can either be uppercase letters([A-Z])...
When using Markup, like on the SE network, an indentation of four spaces before a line of text denotes it as part of a code block, as I hope you know. If you don't, here's an example (with . representing a space): ....Code ....More code results in Code More code The problem is, when you copy-paste code into an answer,...
This challenge is a prize for ais523 for winning the "Rookie of the Year" category in "Best of PPCG 2016". Congratulations! BackFlip is an esoteric programming language made by user ais523, who has created well over 30 other interesting esolangs. BackFlip is a 2D language like Befunge or ><> where the instruction poin...
Backstory I've always found it quite annoying how some numbers in English don't have the same number of syllables even though they have the same number of digits. Example: seven has 2 syllables whereas all of the other digits have one (other than zero). So, when I'm counting in time to something (like a drill cadence i...
Introduction Forte is a very peculiar esoteric language based on the concept of modifying the values of numbers. In Forte numbers are not constants but variables, you can use the LET instruction to assign new values to them. For example, after executing LET 2=4-1 from now on 2 assumes the value of 3, which means that w...
Who doesn't like to chill on a Sunday morning in summer with a chilled beer and TV or in winter playing badminton or ultimate with friends? I always think knowing how many days you have to chill in a month keeps you well-informed and helps you plan what you want to do. Be it sitting in front of your pc and solving a co...
Backstory [which is not true] A piano is set up like this: However, on my piano, all of the black keys are broken! I still want to be able to play some chords on my broken piano though. In music, a chord is a group of notes that are played together. To allow for input of chords, I will first define what a semitone is....
This challenge carries a bounty of 200 points for the first to answer and remain unbeaten for at least 3 days. Claimed by user3080953. There's a lot of talk lately about end-to-end encryption, and pressure on companies to remove it from their products. I'm not interested in the rights-and-wrongs of that, but I wonder...
Given a binary number, your task is to create a 'branch' of that number, with a depth of 2. For example, given 0 as input, you should output exactly this: /000 /00 / \001 0 \ /010 \01 \011 This should be fairly self explanatory of how the branches should be created. Depth 2 means we calculate branc...
Several years back, Hot Wheels made a simple flash game called "Formula Fuelers Racers"*. To play the game, you select three ingredients from a fridge to put into your car, which is then raced against the computer's randomly-generated car. It turns out the mechanics of this game are pretty simple. First off, the act...
Introduction For those not familiar with steam - or at least this particular aspect: Often on peoples' profiles, people leave comments saying either "+rep _____" or "-rep _____". These are an unofficial means of showing whether you think someone in the community has a good or a bad reputation, for a number of reasons. ...
From the Wikipedia article: Location arithmetic (Latin arithmeticæ localis) is the additive (non-positional) binary numeral systems, which John Napier explored as a computation technique in his treatise Rabdology (1617), both symbolically and on a chessboard-like grid. What? Location numerals is a way of writing numb...
Given an ascii-art road and the time it took me to cross it, tell me if I was speeding. Units Distance is in the arbitrary unit of d. Time is in the arbitrary unit of t. The road Here is a simple road: 10===== The 10 means 10 d per t. That is the speed limit for the road. The road has 5 =s, so its d is 5. Therefore, i...
Your task: given a number n, generate a '+' sign that is n characters away from its center. If this is confusing, check out the test cases. Standard methods of input: output must be a string or printed. Standard loopholes apply. Input: 1 Output: + ] 1 away from center `+`. Input: 2 Output: + ] 2 a...
Title misspelled on purpose. Read more to find out why. Your task: given a delimited string or list including the characters A,B,C,D, output the indexes of all the adjacent equal characters. Output can be multiple strings/integers on multiple lines, a list/array, or a delimited string. All output should be in a list or...
In the old DOS operating system, a number of characters were provided to draw boxes. Here is a selection of these characters and their code points: B3 B4 BF C0 C1 C2 C3 C4 C5 D9 DA │ ┤ ┐ └ ┴ ┬ ├ ─ ┼ ┘ ┌ You can use these characters to draw boxes like this: ┌─────────┐ │ │ └─────────┘ Boxes can be at...
Draw a simple ASCII art image containing a straight line. It's similar to this and this but with different specifications. Input You can modify this input format to suit your code. integer width integer height integer x0 integer y0 integer x1 integer y1 Output A filled ASCII art image of the specified width and heigh...
Hexagonal chess describes a family of chess variants played on a board where the cells are hexagons instead of the traditional squares. There are many such variants; in this challenge we'll be focusing on Gliński's variant, which is the most common. The board is composed of three colors (so that the same color doesn't ...
You must make a polyglot that outputs the square of the input in one language and the square root of the input in another. The shortest answer in bytes wins! You must have a precision of at least 3 decimal places, and the input will always be a positive float.
Here's the phonetic alphabet: Alfa Bravo Charlie Delta Echo Foxtrot Golf Hotel India Juliett Kilo Lima Mike November Oscar Papa Quebec Romeo Sierra Tango Uniform Victor Whiskey X-ray Yankee Zulu In the fewest bytes possible: Input will be these words in a random order, with the first letters removed. Your goal is to...
Background As most PPCG regulars will know, a quine is a program which outputs its own source code when run; and the Levenshtein distance between two strings is the minimum number of insertions, deletions, and edits needed to change one string into the other. In this challenge, we're combining the two concepts into a "...
Convert a hexadecimal number (of any size) into a binary number. Input A POSITIVE hexadecimal number with a 0x in the beginning. A valid input will always match the following regex: 0x[0-9a-fA-F]+. If the input is not a valid hexadecimal number, that is, anything not matching this regex, the output should be 0. Output ...
Write a program or function with the following functionality: The program/function first attempts to write the string Hello, world! to the standard output stream. (No other forms of output are acceptable for this challenge, as the focus is very much on the I/O rather than the trivial behaviour of the program itself.) ...
Challenge Given a list of SI base units, a list of equations and a target, you must derive the units of the target using only the base units. Derived Units From Wikipedia: The International System of Units (SI) specifies a set of seven base units from which all other SI units of measurement are derived. Each of these ...
Write a program that is a polyglot in three languages that plays rock–paper–scissors. The input for any version of the program is always one of the strings rock or paper or scissors. In the first language the program must output the rock–paper–scissors choice that beats the input: Input Output rock paper paper...
Recently I posted a question about Diffy games which has gone unanswered. Thats fine, the question is really hard, but I would like to make an easier question about Diffy games so that we can get the ball rolling. How Diffy works Copied from Find Diffy Games The Diffy game works like as follows: You start with a lis...
I am trying to use C# to find the index of the first 1 (right to left) in the binary representation of a number. For example, since 100 in binary is: 0b1100100 The first 1 is in the third position from the right, so it should yield 3. 234 should yield 2, 0 should yield 0, etc. Here is my current solution: k < 1 ? 0 :(...