text
stringlengths
180
608k
[Question] [ A question that had popped up in my head once - how many NAND gates would it take to build a larger, "meta-NAND" gate? Your task is to build a black-box circuit that takes two input wires `A` and `B` and returns one output wire that satisfies `A NAND B`, subject to the following restrictions: * You m...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/3741/edit). Closed 7 years ago. [Improve this question](/posts/3741/edit) ...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This site is for programming contests and challenges. **General programming questions** are off-topic here. You may be able to get help on [Stack Overflow](http://stackoverflow.com/about)...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 4 years ag...
[Question] [ What is the shortest way to check if two or more variables are equal to 0 in JavaScript? I'm curious to know if there's something shorter than `if(!x&&!y&&!z){...}`. [Answer] (**EDIT:** This first part refers to the original phrasing of the question.) First, `(!x&&!y&&!z)` returns a boolean,...
[Question] [ 8-bit XOR encryption takes a single byte and XORs every byte in the file by that byte. Here is a reference program in C++: ``` /*xorcipher.cpp *Encrypts a file using 8-bit xor encrytpion */ #include <iostream> #include <fstream> #include <stdlib.h> using namespace std; int main(int argc, char** arg...
[Question] [ This is how I checkout to see if a number is in a range (in between two other numbers): ``` var a = 10, b = 30, x = 15, y = 35; x < Math.max(a,b) && x > Math.min(a,b) // -> true y < Math.max(a,b) && y > Math.min(a,b) // -> false ``` I have to do this math in my code a lot and I'm looking ...
[Question] [ **This question already has answers here**: [Find the occurrences of a character in an input string](/questions/55880/find-the-occurrences-of-a-character-in-an-input-string) (58 answers) Closed 4 years ago. Your task is to input a string, and output the number of spaces in the string. This is ...
[Question] [ **This question already has answers here**: [Convert a string of binary characters to the ASCII equivalents](/questions/35096/convert-a-string-of-binary-characters-to-the-ascii-equivalents) (69 answers) Closed 6 years ago. Your task is to write a program, which takes a binary input and convert...
[Question] [ # Task Given positive integer `n`, output `a(n)` where `a` is the sequence defined below: `a(n)` is the smallest positive integer not yet appeared so that the sum of the first `n` elements in the sequence is divisible by `n`. # Example * `a(1)` is `1` because it is the smallest positive integer that ...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/48883/edit). Closed 8 years ago. [Improve this question](/posts/48883/edit)...
[Question] [ I have to fill in 2fa codes all day. They're 6-digit strings. One day I noticed that not once did any of these codes contain 6 unique digits, like 198532 There was always at least one double, like 198539 (here it's 9). For any given uniformly random string of \$N\$ digits in the set \$\{0,1,2,3,4,5,6...
[Question] [ **This question already has answers here**: [Determine whether strings are anagrams](/questions/1294/determine-whether-strings-are-anagrams) (162 answers) Closed 9 years ago. This is an easy one. [Anagrams](http://en.wikipedia.org/wiki/Anagram) are words which have the same characters but in d...
[Question] [ I have a source file here: ``` #include <FizzBuzz.h> fizzbuzz ``` And I want to make "`fizzbuzz`" turn into a FizzBuzz program solely through the preprocessor. Your task is to write a `FizzBuzz.h` that uses only preprocessor directives (things like include, define, etc.) to create a working FizzBuzz ...
[Question] [ **This question already has answers here**: [What's the day today (or other dates)?](/questions/2878/whats-the-day-today-or-other-dates) (7 answers) Closed 7 years ago. Please write a program that takes as input two numbers 'day of the month' and 'month number' for any day of this year (2012) ...
[Question] [ This is an [answer-chaining](/questions/tagged/answer-chaining "show questions tagged 'answer-chaining'") post, so in this challenge every answer (except the first answer) depends on the previous answer. The goal of this challenge is to output the restricted characters. The restricted characters are ...
[Question] [ # Input An array A of integers of length 100,000. The array will contain only integers in the range 0 to 1e7. # Output The convolution of A with itself. As this will be of length 199999 you should time just the convolution calculation however, not the time to print out the answer. # Example in Python...
[Question] [ For the purpose of this challenge, a smaller-base palindrome (SBP) is a number which is palindromic in a base between 1 and itself (exclusive), and is not a repdigit in the same base. For example, 5 is a SBP because it is a palindrome in base 2 (101). The first few SBPs are `5,9,10,16,17,20,21,23,25,...
[Question] [ This challenge consist in adding commas to numbers every `3` spaces like: ``` 123456789 => 123,456,789 ``` ## Specifications: * The possible inputs will be `1,000 <= input <= 100,000,000` * You can ONLY use Mathematical Operators * (\*) You can NOT do string, array, index or character manipulation * ...
[Question] [ ### Backstory, skip if you like Generating high quality pseudo random numbers is a tricky business but the fine engineers at < enter company you love to hate > have mastered it. Their progress bars effortlessly rise above the primitive notion of linearly passing time and add an exhilarating sense of ...
[Question] [ A [magic square](https://en.wikipedia.org/wiki/Magic_square) is an \$ n \times n \$ square grid, such that the sum of the integers on each row and column are equal. Note that the definition which will be used in this challenge is different than the one used by Wikipedia, since * diagonal sums are not...
[Question] [ **Intro -** Nearest neighbour comparison between two arrays is something that can be done very efficiently when only 1 variable per array is involved, because it can be done by sorting and then performing a rolling comparison. However, for a 2 variable comparison this sort operation cannot be done an...
[Question] [ Given two inputs, a distance \$d\$ and a number \$n\$ output a list of \$n\$ random colors which each have distance \$d\$ from the previous. ## Background A [random walk](https://en.wikipedia.org/wiki/Random_walk) is a path which is defined by choosing a random direction and (usually) fixed distance ...
[Question] [ You've [gotten out of Earth's gravity well](https://codegolf.stackexchange.com/q/252264/114332) - good for you! However, you're feeling a bit uncomfortable in zero-gravity, and you want to replicate 1 \$g\$ of force in a centrifuge. Use the [equation for force in a centrifuge](https://en.wikipedia.or...
[Question] [ **(2 Jan 2018) Because of the winning criteria I am going to accept the Jelly answer, but I am also giving upvotes to all other answers which all use astounding methods as well** ## Introduction There are lots of challenges asking for a shortest program to calculate mathematical constants. I saw some...
[Question] [ Your task today is to create a HTML page. This page, when opened in a browser, behaves as if the browser has a problem (hanging, crashing, network error, virus, etc.) * You **can** use all the HTML(5), CSS(3) and JavaScript features you want. * You **can't** use Flash or other plugins. * You **can't*...
[Question] [ **This question already has answers here**: [Golf the Subset-Sum Problem](/questions/8655/golf-the-subset-sum-problem) (15 answers) Closed 10 years ago. Given an integer array. You have to check whether it is possible to divide the array in two parts such that the sum of elements of one part i...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/6351/edit). Closed 7 years ago. [Improve this question](/...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/206769/edit). Closed 3 years ago. [Improve this question](/posts/206769/edi...
[Question] [ ## This is the cops' thread, the robbers' thread is [here](https://codegolf.stackexchange.com/questions/172222/polycops-and-robbers-robbers-thread) A polyglot is a program, that without modification, can run in multiple languages. --- # Allowed languages Any language that was made before the challeng...
[Question] [ **This question already has answers here**: [Finding "sub-palindromes".](/questions/183/finding-sub-palindromes) (37 answers) Closed 6 years ago. A [palindrome](https://en.wikipedia.org/wiki/Palindrome) is a string which is the same when read forwards and backwards. For example "racecar" is a ...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/17981/edit). Closed 8 years ago. [Improve this question](...
[Question] [ Given two rectangular arrays, A and B, let's say that A is *embedded* in B if A can be obtained from B by deleting some (or none) of the rows and columns of B. Write a program with the following I/O: **Input**: two arbitrary rectangular arrays of letters (a-z), as a string from stdin. **Output**: ...
[Question] [ Write a function `f(a,b)` that returns `a mod b` given the constraints: * you can't use division in any way * `f(a,b)` is always positive, eg: `f(-1,5) = 4` * it performs reasonably well for values of ~`10e50` for `a` and `b` [Answer] ## Haskell ~~36~~ 35 (~~34?~~ 33) If I may call the functio...
[Question] [ Write the shortest code that traverses a tree, depth-first. **Input** Any programmatical structure found in your language of choice: lists, tuples, queues etc. **Output** A list of "names" of the nodes in correct order as shown in [Depth-first search](http://en.wikipedia.org/wiki/Depth-first_search) ...
[Question] [ Your task is to automatically complete URLs like the address bar in most browsers is doing. We will use the following (simplified) rules: * If the input string starts with `http://`, `ftp://` or `https://`, return the string unchanged. * Otherwise, if the input string contains a dot `.`, e.g. `in.put...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/17368/edit). Closed 6 years ago. [Improve this question](...
[Question] [ One of my colleagues proposed us a challenge: to write the shortest C/C++ program to determine if a number is even or odd. These are the requirements: * Get a number from keyboard, at run-time (not from command line) * Output the string `pari` if the number is even * Output the string `dispari` if th...
[Question] [ **Overview** Adding slightly to [the complexity of working with Roman numerals](https://codegolf.stackexchange.com/q/6005/3862)... The ancient Romans devised a number system using Latin letters, which served them well, and which is still used by modern civilization, though to a much smaller degree....
[Question] [ I recently tried to produce the shortest C code possible to display all its command line arguments (which are stored in argv). I ended with a relatively small piece of code, and I was wondering if there was some trick I'm not aware of. Here's my try (I compile with C17, but any standard before C23 ...
[Question] [ [Greeklish](https://en.wikipedia.org/wiki/Greeklish), a portmanteau of the words Greek and English, is a way of writing modern Greek using only ASCII characters. This informal way of writing was extensively used in older applications / web forums that did not support Unicode, and were not programmed ...
[Question] [ **Expand an array to all directions by duplicating the outer elements** You will be given two inputs: an array and the expansion degree For example if I give you `[[1,2,3][4,5,6][7,8,9]]` and `3`, you must output: ``` 1 1 1 1 2 3 3 3 3 1 1 1 1 2 3 3 3 3 1 1 1 1 2 3 3 3 3 1 1 1 1 2 3 3 3 3 4 4 4 4...
[Question] [ Your dumb teacher is always wrong, so flip his answer. ### Change these responses ``` True -> False Yes -> No 0 -> 1 Yeah -> Nope ``` and vice versa. Keeping punctuation and the first letter's capitalization counts. Only one condition will be passed to the program. **You only need to accept the fol...
[Question] [ I like to do programming challenges in my free time to teach myself and keep fresh, this one I can't seem to optimize though and it's driving me insane. The goal is essentially, "Given a number, return the numbers leading up to it as a palindrome." For example if you are given the input `5` the answe...
[Question] [ Your task is to create many programs. The first outputs `1`, the second outputs `2`, etc. The higher you can go, the better! However, all of these programs must be made the same list of characters. You can choose which characters to put in the list. Each program can only use a character as many times...
[Question] [ Consider the set of 16-character strings containing only the [95 printable ASCII characters](http://en.wikipedia.org/wiki/ASCII#ASCII_printable_characters). There are 9516 ≈ [4.4×1031](http://www.wolframalpha.com/input/?i=95%5E16) such strings. Imagine these strings are put into a list and sorted [le...
[Question] [ Your program or function should output all the [36 4-perfect numbers](http://oeis.org/A027687/b027687.txt) in increasing order separated by newlines. An `n` positive integer is a `k`-perfect number ([multiply perfect number](http://en.wikipedia.org/wiki/Multiply_perfect_number)) if the sum of its div...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- This question does not appear to be about code golf or coding challenges within the scope defined in the [help center](https://codegolf.stackexchange.com/help/on-topic). Closed 1 year ago...
[Question] [ Given two integers `m` and `n`, return the first `m` digits of `sqrt(n)`, with the decimal point. They will be given with a space in between. You only have to produce `m` digits: so if `m=5, n=500`, then the output will be `22.360`, not `22.36067`. **Do not use anything that will increase the precisi...
[Question] [ There was a prior question about [golfing an HQ9+ compiler](https://codegolf.stackexchange.com/questions/84170/golf-me-an-hq9-compiler) that translates HQ9+ code into the language it is written in, but that was closed as a duplicate of [the interpreter challenge](https://codegolf.stackexchange.com/qu...
[Question] [ Consider: ``` c=(a,b)=>(+a||0)+(+b||0) ``` Yes, it is not good to solve it like that. But I want to shorten it even more. If `a` is a string and `b` is a string, then return `0`. If one is a number, return it. And if both inputs are numbers, then return the sum (if either string can be cast to a numb...
[Question] [ **This question already has answers here**: [Return each number from a group of numbers](/questions/8588/return-each-number-from-a-group-of-numbers) (21 answers) Closed 8 years ago. ## Goal: Your goal is to print out numbers within a given range (*Also including given values*). ## Input Format...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/32207/edit). Closed 5 years ago. [Improve this question](/posts/32207/edit)...
[Question] [ Your challenge is to write a routine, in x86 assembly, which takes a buffer containing 32-bit signed integers and writes a sorted list of the prime values to another buffer, then returns the number of values written to the output buffer. The winning solution is the one that uses the **least instructi...
[Question] [ Oplop is an algorithm to generate website specific passwords based on a master password and a keyword. It is described here: <http://code.google.com/p/oplop/wiki/HowItWorks> There's an online implementation here: <https://oplop.appspot.com/> My attempt in Q is 204 200 167 165 139 characters ignoring ...
[Question] [ ## Challenge (Easy) > > Write a function which takes an argument and returns the number of non-alphanumeric characters found. > > > ## Challenge (Hard) > > Write a function which takes an argument and returns the number of bytes used to store the number of non-alphanumeric characters found. (ie:...
[Question] [ Write a program rotates some Cartesian coordinates through an angle about the origin (0.0,0.0). The angle and coordinates will be read from a single line of stdin in the following format: ``` angle x1,y1 x2,y2 x3,y3 ... ``` eg. ``` 3.14159265358979 1.0,0.0 0.0,1.0 1.0,1.0 0.0,0.0 ``` The results sh...
[Question] [ # Objective Given two non-negative integers encoded in unbounded-length [Gray code](https://en.wikipedia.org/wiki/Gray_code), add them and output the result, where the result is also encoded in Gray code. # Gray code There are many equivalent formulations of Gray code, but here's an intuitive one. Th...
[Question] [ Define the (unnormalised) [Willmore energy](https://en.wikipedia.org/wiki/Willmore_energy) of a surface as the integral of squared mean curvature over it: $$W=\int\_SH^2\,dA$$ For surfaces topologically equivalent to a sphere \$W\ge4\pi\$, and \$W=4\pi\$ iff it is actually a sphere. Thus the energy q...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/168450/edit). Closed 5 years ago. [Improve this question](/posts/168450/edi...
[Question] [ This question is similar to [Do the circles overlap?](https://codegolf.stackexchange.com/questions/135960/do-the-circles-overlap), except your program should return True if the circumference of one circle intersects the other, and false if they do not. If they touch, this is considered an intersectio...
[Question] [ Given a number `n`, you must output a [golden spiral](http://en.wikipedia.org/wiki/Golden_spiral) with the number of quarter turns being `n`. The spiral must be completely black and the background must be completely white. This must be output as a φ⌊n/4⌋\*4 by φ⌊n/4⌋\*4 PNG file (you may output a PPM...
[Question] [ # Penalty shootout Welcome to CG world cup. Your job: Code a penalty shooter and goal keeper! --- ## Rules of the game: The goal is 700 cm wide and 200 cm tall. If I have to make a rectangle out of it, the goal is ABCD where A is `(0,0)`, B is `(0,200)`, C is `(700,200)`, D is `(700,0)`. The shooter ...
[Question] [ The objective of this question is to create a program that pushes your computer's internal fan speed to its maximum RPM. Upon exiting the program, your fan should return to the normal operating RPM. **Rules:** 1. You may not perform a CPU intensive task in order to modify the fan's speed. 2. Exiting ...
[Question] [ Given a string, mark which parts in the string repeat in box brackets, and write how many times it does so before the box. Example:`st st st Hello ThereThere` `st`(with a space after) repeats 3 times, `There` repeats 2 times, and `l` repeats 2 times in `Hello`, so the output will be: `3[st ]He2[l...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/2291/edit). Closed 1 year ago. [Improve this question](/posts/2291/edit) W...
[Question] [ I found this task [here](http://www.spoj.pl/SHORTEN/problems/FIBSUM/). > > Given the ith (1<=i<=35) Fibonacci > number F(i) calculate the sum of the > ith till i+9th number > F(i)+F(i+1)+...+F(i+9) and the last > digit of the i+246th one F(i+246) > > > I have been trying to solve this using p...
[Question] [ It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, [visit the help center](/help/reopen-questions). Closed...
[Question] [ One of your acquaintances has a hobby of making make-shift electrical gadgets using various types of batteries. However, since they're thrifty, they want to use as few batteries as possible for their projects. This challenge uses several types of batteries; your job is to output the fewest number of ...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/200821/edit). Closed 3 years ago. [Improve this question](/posts/200821/edi...
[Question] [ # Find the most important character The challenge is to write a program that outputs the most occurrent character in the input string, excluding these bracketing characters `()[]{}`. Each submission should consist only of non-trivial\* characters. Each solution is scored using the formula in the scor...
[Question] [ The code: ``` function L(){N=null;E=[N,N];t=this;h=E;t.u=i=>h=[i,h]; t.o=_=>h==E?N:h[+!(h=h[1])];t.e=(i,l)=>h=(l||h)==E?[i, E]:[(l||h)[0],t.e(i,(l||h)[1])];t.s=_=>{o="";while(i=t.o()) {o+=i+","}return o}} ``` For my response to this (old) question: <https://codegolf.stackexchange.com/a/196783/72421>...
[Question] [ **This question already has answers here**: [Cover up zeroes in a list](/questions/65770/cover-up-zeroes-in-a-list) (61 answers) Closed 4 years ago. Given a non-empty list of decimal digits (`0`, `1`, ..., `9`), replace each zero by the most recent nonzero, if possible. **Example 1**: given ``...
[Question] [ **Closed**. This question needs to be more [focused](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Update the question so it focuses on one problem only by [editing this post](/posts/193093/edit). Closed 4 years ago. [Improve this question]...
[Question] [ The ChatRoom is [here](https://chat.stackexchange.com/rooms/83075/reaper-russian-bs) I love playing the card game BS, but sometimes, it just doesn't have enough **oomph** for my short attention span. Instead, let's play some Russian BS. # Rules [Here](https://www.instructables.com/id/How-to-play-bluf...
[Question] [ A few days ago, I came up with a fun card game to play with my friends. We were having fun playing it, when I thought, "Why not make this a KoTH?" So, here it is! ## Overview In this game, the objective is to get the most points. Your bot starts with 0 points and 20 energy. Every turn (500 in a game)...
[Question] [ This is [cops-and-robbers](/questions/tagged/cops-and-robbers "show questions tagged 'cops-and-robbers'"). This is the **Robbers** thread. For the cops thread, go [here](https://codegolf.stackexchange.com/questions/128065/stealing-sequences-cops). I've noticed a number of OEIS challenges since I join...
[Question] [ Input into your program a black and white image. (png, jpg, etc) Convert the image to a 2D matrix of pixels, where each index is the grayscale value of the image. Take each index of the matrix and average the 8 pixels around it. Then replace that index with the average. For example if you had: ``` 12...
[Question] [ The official release of the Nintendo 64 in North America was on September 29, 1996.[[1]](http://en.wikipedia.org/wiki/Nintendo_64) I figured that this anniversary deserved an ASCII art challenge. There's one small twist though, you have to output a different ASCII art for each of three different inpu...
[Question] [ Aside of nursing my child, [Vitsy](https://github.com/VTCAKAVSMoACE/Vitsy), and dabbling in the art of code golf, I also am an avid dubstep fan, listening to all the new dubstep that [Monstercat](https://www.youtube.com/user/MonstercatMedia) puts out as regularly as I can. I also share a random dubst...
[Question] [ **This question already has answers here**: [Can you Meta Quine?](/questions/5510/can-you-meta-quine) (6 answers) Closed 7 years ago. Write a program or function which, when run, outputs another program or function which is valid in the same language as the original program, and which itself w...
[Question] [ ## NOTE: This question was migrated from <https://stackoverflow.com/q/27134588/1442685> PHP QUESTION Almost purely out of curiousity, how can I take an array like this: ``` array( 'fruit' => 'banana', 'drink' => 'milk') ``` And convert it to an array like this: ``` array( 'fruit=banana', 'drink=milk'...
[Question] [ **Forward:** Depending on what language you use and what user you are logged in as this challenge could be dangerous so proceed with Caution! You could delete something, fork bomb yourself, or worse... **Challange:** Write a program of n bytes which creates n copies of itself on disk, modifies the fi...
[Question] [ **Closed.** This question is [off-topic](/help/closed-questions). It is not currently accepting answers. --- Questions without an **objective primary winning criterion** are off-topic, as they make it impossible to indisputably decide which entry should win. Closed 6 years ago. [Improve this que...
[Question] [ Your task is to solve a new puzzle called Cubax. This toy is actually a Chinese puzzle whose expected “final” state is a simple cube. During the festivities, Cubax unfolded, because it cannot move when folded. Cubax is composed of `N³` smaller cubes (elements) linked together in a kind of doubly link...
[Question] [ This challenge is one of the two challenges which were planned for [Advent of Code Golf 2021](https://codegolf.meta.stackexchange.com/q/24068/78410), but didn't fit into the 25-day schedule. Related to [AoC2020 Day 22](https://adventofcode.com/2020/day/22), Part 2. --- Combat is a simple two-player c...
[Question] [ When I was posting answers for the [Husk Language of The Month thread](https://codegolf.meta.stackexchange.com/a/19387/80214), I realized it took more time to enter them in the thread than it took to actually write the answers. So, why not automate it? Write a program/function which inputs a language...
[Question] [ Consider \$3\$ binary strings of length \$n\$ chosen independently and uniformly at random. We are interested in computing the exact expected minimum [Hamming distance](https://en.wikipedia.org/wiki/Hamming_distance) between any pair. The Hamming distance between two strings of equal length is the nu...
[Question] [ Do you know the book *Murderous Maths*, in the *Horrible Science* series? In the book, the Laplace Princess' "ridiculous" cipher might be interesting enough and simple enough to be a code-golf challenge. # Task The original cipher looks like this: > > Please read primes elephant help you me like col...
[Question] [ 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](http://m...
[Question] [ # 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. O...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/60230/edit). Closed 8 years ago. [Improve this question](/posts/60230/edit)...
[Question] [ I need to reduce the length of this code in Python 3 as much as possible (even if it will be less readable): ``` a,b,x,y=[int(i) for i in input().split()] while 1: r='' if y<b:r='S';y+=1 if y>b:r='N';y-=1 if x<a:r+='E';x+=1 if x>a:r+='W';x-=1 print(r) ``` It's a map: you are on (x,y) and you ...
[Question] [ **Closed**. This question needs [details or clarity](/help/closed-questions). It is not currently accepting answers. --- **Want to improve this question?** Add details and clarify the problem by [editing this post](/posts/40816/edit). Closed 7 years ago. [Improve this question](/posts/40816/edit)...
[Question] [ This challenge asks you to draw the Eiffel Tower in 3D using different ASCII characters to represent the different sides, similar to this cube: ``` @@@ @@@@@@@@@ @@@@@@@@@@@@@@@ x@@@@@@@@@@@@&& xxx@@@@@@@@&&&& xxxxx@@@&&&&&&& xxxxxx&&&&&&&&& xxxxx&&&&&&& xxx&&&& x&& ``` Here is a pi...
[Question] [ Write a program to convert Polish prefix notation to infix notation, then change it to an RPN-to-infix converter in the shortest number of chars. Your score is 100 minus the number of characters changed, added and deleted. * Don't write one PPN and one RPN function, then do something like: "*I chan...
[Question] [ You are given two functions \$g(x)\$ and \$h(x)\$, each of which takes an integer \$x\$ and returns the number \$ax + b\$ (where \$a\$ and \$b\$ are integers defined in the function). Your task is to write a function \$f(g, h)\$ that takes these two functions, and returns a function \$k(x) = g(h(x))\...
[Question] [ The challenge is to give as short code as possible to print an ASCII histogram of a set of data. **Input.** The number of bins followed by a number of integers representing the data. The data are space separated. **Output.** An ASCII histogram of the data using the specified number of bins. **Score.*...
[Question] [ This is similar to other hang-man style problems already posted, except, in this case, the computer is the one guessing. Computers are logical, smart, and consider self-preservation to be important, so there are a few RULES for how computers will guess. The user will think of any word, that will be c...
[Question] [ A similar play on the boggle problem from before (some text from that has been used below, edited to fit) any code that solves the familiar "text-twist" game ### Objective 7 letters are given at random, to which there is a minimum 1 word that uses all 7 letters, and multiple words using less (3 or mo...