text stringlengths 26 126k |
|---|
[Question]
[
Challenge Taken with permission from my University Code Challenge Contest
---
For some years now, the number of students in my school has been growing steadily. First the number of students was increased by classroom, but then it was necessary to convert some spaces for some groups to give classes th... |
[Question]
[
**Problem:**
Find the number of leading zeroes in a 64-bit signed integer
**Rules:**
* The input cannot be treated as string; it can be anything where math and bitwise operations drive the algorithm
* The output should be validated against the 64-bit signed integer representation of the number, regar... |
[Question]
[
My two kids like to play with the following toy:
[](https://i.stack.imgur.com/BYhak.jpg)
The colored areas with the shapes inside can be touched and the turtle then lights the area and plays a sound or says the name of the color or the shape inside. The m... |
[Question]
[
Use any programming language to display "AWSALILAND" in such a way, so that each letter is in a new line and repeated as many times as its position in the English alphabet. For example letter, (A) should be displayed just once because it is the first letter of the alphabet. Letter D should be display... |
[Question]
[
**Final Standings**
```
+----------------------------------+---------+---------+---------+----------------------------+
| Name | Score | WinRate | TieRate | Elimination Probability |
+----------------------------------+---------+---------+---------+-------------------... |
[Question]
[
Given integers `N , P > 1` , find the largest integer `M` such that `P ^ M ‚â§ N`.
### I/O:
Input is given as 2 integers `N` and `P`. The output will be the integer `M`.
### Examples:
```
4, 5 -> 0
33, 5 -> 2
40, 20 -> 1
242, 3 -> 4
243, 3 -> 5
400, 2 -> 8
1000, 10 -> 3
```
### Notes:
The input wil... |
[Question]
[
Today's challenge is simple: Without taking any input, output any valid sudoku board.
In case you are unfamiliar with sudoku, [Wikipedia describes what a valid board should look like](https://en.wikipedia.org/wiki/Sudoku):
>
> The objective is to fill a 9×9 grid with digits so that each column, each... |
[Question]
[
As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by "golfing" it!
So it goes simply like that:
>
> Without using numbers, write a code that outputs the annua... |
[Question]
[
Background: the Ramsey number \$R(r,s)\$ gives the minimum number of vertices \$v\$ in the complete graph \$K\_v\$ such that a red/blue edge coloring of \$K\_v\$ has at least one red \$K\_r\$ or one blue \$K\_s\$. Bounds for larger \$r, s\$ are very difficult to establish.
Your task is to output the... |
[Question]
[
*This challenge is based on, and contains test cases from, [a programming course](http://mooc.aalto.fi/ohjelmointi/scala_2017.html) I took at Aalto University. The material is used with permission.*
Two and a half years ago there was a challenge about [spoonerisms in English](https://codegolf.stackex... |
[Question]
[
# Rotonyms 2
A "Rotonym" is a word that ROT13s into another word (in the same language).
For this challenge, we'll use an alternate definition: a "Rotonym" is a word that circular shifts/rotates into *another* word (in the same language).
For example:
```
'stable' < 'tables' < 'ablest'
'abort' > 'tab... |
[Question]
[
# Problem
Let's define a generalized [Cantor set](https://en.wikipedia.org/wiki/Cantor_set) by iteratively deleting some rational length segments from the middle of all intervals that haven't yet been deleted, starting from a single continuous interval.
Given the relative lengths of segments to delet... |
[Question]
[
Today's challenge is to draw a [binary tree](https://en.wikipedia.org/wiki/Binary_tree) as beautiful [ascii-art](/questions/tagged/ascii-art "show questions tagged 'ascii-art'") like this example:
```
/\
/ \
/ ... |
[Question]
[
This question is similar to [Biggest Square in a grid](https://codegolf.stackexchange.com/questions/152305/biggest-square-in-a-grid).
**Challenge**
Given a matrix of `1` and `0` in a string format `"xxxx,xxxxx,xxxx,xx.."` or array format `["xxxx","xxxx","xxxx",...]`, You will create a function that d... |
[Question]
[
A string can be *shifted* by a number `n` by getting the byte value `c` of each character in the string, calculating `(c + n) mod 256`, and converting the result back to a character.
As an example, shifting `"ABC123"` by 1 results in `"BCD234"`, shifting by 10 in `"KLM;<="`, and shifting by 255 in `"... |
[Question]
[
Write a function or program that determines the *cost* of a given string, where
* the cost of each character equals the number of how many times the character has occurred up to this point in the string, and
* the cost of the string is the sum of its characters' costs.
### Example
For an input of `a... |
[Question]
[
## Challenge:
Given a string only containing upper- and/or lowercase letters (whichever you prefer), put `tape` horizontally to fix it. We do this by checking the difference of two adjacent letters in the alphabet (ignoring wrap-around and only going forward), and filling the space with as much `TAPE... |
[Question]
[
We say a string is *non-discriminating* if each of the string's characters appears the same number of times and at least twice.
### Examples
* `"aa!1 1 !a !1"` is *non-discriminating* because each of the characters , `!`, `a` and `1` appear three times.
* `"abbaabb"` is **not** *non-discriminating* b... |
[Question]
[
Given no input, output this interesting alphabet pattern in either case (the case has to be consistent) via an [accepted output method](https://codegolf.meta.stackexchange.com/questions/2447/default-for-code-golf-input-output-methods):
```
A
AB
ACBC
ADBDCD
AEBECEDE
AFBFCFDFEF
AGBGCGDGEGFG
AHBHCHDHEHF... |
[Question]
[
This has no practical purpose but it could be fun to golf.
# Challenge
Given a number *n*,
1. Count the amount of each digit in *n* and add 1 to each count
2. Take the prime factorization of *n*
3. Count the amount of each digit in the prime factorization of *n*, without including duplicate primes
4.... |
[Question]
[
Your task is to program a mathematical function \$s\$, that takes a nonempty finite set \$A\$ of points in the 2D plane, and outputs an uncircularity score \$s(A)\$ that satisfies following properties:
1. *Positive Definiteness*: If there is a circle or a straight line that contains all points of \$A... |
[Question]
[
A deck of cards is the Cartesian product of `S` suits and `R` ranks.
Many, though not all, card games use `S=4` and `R∊{6,8,13}`.
A hand of `H` cards is dealt from the deck.
Its *distribution*, a.k.a. "hand pattern", is an array that describes
how many cards you got from each suit, ignoring suit orde... |
[Question]
[
There are several ways to create headers on posts on the Stack Exchange network. The format that's most commonly1 used on PPCG seems to be:
```
# Level one header
## Level two header
### Level three header
```
Note the space after the hash marks. Also, note that trailing hash marks are not included. ... |
[Question]
[
This challenge is similar [to my previous one](https://codegolf.stackexchange.com/questions/144053/distances-to-coordinates), but has a twist that makes it significantly more difficult.
There are *n* people on a 2D plane. Using distances between them we're going to find their positions. You may make ... |
[Question]
[
Given an integer `n >= 2`, output the largest exponent in its prime factorization. This is OEIS sequence [A051903](https://oeis.org/A051903).
## Example
Let `n = 144`. Its prime factorization is `2^4 * 3^2`. The largest exponent is `4`.
## Test Cases
```
2 -> 1
3 -> 1
4 -> 2
5 -> 1
6 -> 1
7 -> 1
8 ->... |
[Question]
[
[Life-like cellular automaton](https://en.wikipedia.org/wiki/Life-like_cellular_automaton) are cellular automaton that are similar to Conway's Game of Life, in that they operate on a (theoretically) infinitely large square grid, where each cell has exactly 8 neighbours, and is one of 2 states, namely... |
[Question]
[
For challenges related to the Swift language. Note that language specific challenges are generally discouraged.
Download Swift: <http://swift-lang.org/downloads/index.php>
]
|
[Question]
[
Given an input list of non-empty strings, output an ASCII art representation of a tournament, based on the following drawing rules:
* The number of strings is guaranteed to be of quantity `2,4,8,16,etc.`
* The first two strings play each other, and the next two play each other, and so on. This is the... |
[Question]
[
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with [hello-world](/questions/tagged/hello-world "show questions tagged 'hello-world'"), and counting). While this is not the most interesting code golf in the common lan... |
[Question]
[
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](https://oeis.org/A007304) in the OEIS.
## Your Task:
Write a program or function to determine whether an inputted ... |
[Question]
[
The [Fibonacci sequence](http://oeis.org/A000045) is a sequence of numbers, where every number in the sequence is the sum of the two numbers preceding it. The first two numbers in the sequence are both 1. Here are the first few terms:
```
1 1 2 3 5 8 13 21 34 55 89 ...
```
---
Write the shortest code... |
[Question]
[
# Challenge
So, um, it seems that, while we have plenty of challenges that work with square numbers or numbers of other shapes, we don't have one that simply asks:
Given an integer `n` (where `n>=0`) as input return a truthy value if `n` is a perfect square or a falsey value if not.
---
## Rules
* Yo... |
[Question]
[
## Challenge
A [repdigit](https://oeis.org/wiki/Repdigit_numbers) is a non-negative integer whose digits are all equal.
Create a function or complete program that takes a single integer as input and outputs a truthy value if the input number is a repdigit in base 10 and falsy value otherwise.
The inp... |
[Question]
[
In this challenge, you should write a program or function which takes no input and prints or returns a string with the same number of bytes as the program itself. There are a few rules:
* You may only output bytes in the printable ASCII range (0x20 to 0x7E, inclusive), or newlines (0x0A or 0x0D).
* Y... |
[Question]
[
My father who [was a really good APLer](https://youtu.be/pL8OQIR5cB4?t=3m16s) and taught me all the basics of APL (and much more), passed away on this day, five years ago. In preparation for [50 Years of APL](http://www.dyalog.com/50-years-of-apl.htm), I found [this patent letter](https://tidsskrift.... |
[Question]
[]
|
[Question]
[
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 Ki... |
[Question]
[
*Note: This is the **cops'** thread, where one should post the scrambled code. Here is the **[robbers' thread](https://codegolf.stackexchange.com/questions/115034/robbers-square-times-square-root)*** where the cracked source should be posted and linked to the cop's answer.
---
**Task:** Write the sho... |
[Question]
[
On most [new-years](/questions/tagged/new-years "show questions tagged '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 su... |
[Question]
[
## 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
... |
[Question]
[
How many of you that still use your own knuckle to determine whether a month is having a full 31 days or less?
You job is to write a program to count how many months, in a month range, are having a full 31 days and how many are having less than 31 days by "counting the knuckles".
[![Counting days of ... |
[Question]
[
Usually, it is said that "Doing X without Y" can be a trap to beginners writing challenges ([source](http://meta.codegolf.stackexchange.com/questions/8047/things-to-avoid-when-writing-challenges/8079#8079)). However, I am cocky and think that I can *definitely* make an X without any Ys. Randomly. Oh ... |
[Question]
[
This is a Code Golf challenge.
[Flood](http://www.chiark.greenend.org.uk/~sgtatham/puzzles/js/flood.html) is a game in which the player is presented with a game board such as this:
[](https://i.stack.imgur.com/RWaO2m.png)
On each turn, you ch... |
[Question]
[
A simple FizzBuzz using strings.
**Given**
* 1 word or phrase (string)
* 2 unique characters
**Output**
The word or phrase with each occurrence of the first character replaced with fizz and each of the second character replaced with buzz
**Rules**
* The first letter in both Fizz and Buzz must remain ... |
[Question]
[
In this exercise, you have to analyze records of temperature to find the closest to zero.
Write a program that prints the temperature closest to 0 among input data.
## Input
* N, the number of temperatures to analyse (optional). This will be nonzero.
* The N temperatures expressed as integers ranging... |
[Question]
[
# Summary:
For any given language, what is the smallest amount of unique characters for your language to be [Turing-Complete](https://en.wikipedia.org/wiki/Turing_completeness)?
# Challenge:
For any language of your choice, find the smallest subset of characters that allows your language to be Turing... |
[Question]
[
Your task is to write a program or a function that prints an ASCII triangle. They look like this:
```
|\
| \
| \
----
```
Your program will take a single numeric input `n`, with the constraints `0 <= n <= 1000`. The above triangle had a value of `n=3`.
The ASCII triangle will have `n` backslashes (... |
[Question]
[
Long-time lurker, first-time poster. So here goes.
In the Wikipedia page for [quine](https://en.wikipedia.org/wiki/Quine_%28computing%29#.22Cheating.22_quines), it says that "a quine is considered to be 'cheating' if it looks at its own source code." Your task is to make one of these "cheating quines... |
[Question]
[
It's Christmas everybody, and here's a code-golf challenge to celebrate. You need to make a program to print out a present. Specifically, the words "Merry Christmas". BUT, there is a catch: this program must only work if it is the 25th of December. If the code is run on any other day, then the progra... |
[Question]
[
We had a [prime factorization challenge](https://codegolf.stackexchange.com/q/1979/42545) a while ago, but that challenge is nearly six years old and barely meets our current requirements, so I believe it's time for a new one.
## Challenge
Write a program or function that takes as input an integer gr... |
[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/68666/edit).
Closed 2 years ago.
[Improve this question](/posts/68666/edit)... |
[Question]
[
# Binary to decimal converter
As far as I can see, we don't have a simple binary to decimal conversion challenge.
---
Write a program or function that takes a positive binary integer and outputs its decimal value.
You are not allowed to use any builtin base conversion functions. Integer-to-decimal fu... |
[Question]
[
## The challenge is to calculate the digit sum of the factorial of a number.
---
Example
```
Input: 10
Output: 27
```
10! = 10 × 9 × ... × 3 × 2 × 1 = 3628800,
and the sum of the digits in the number 10! is 3 + 6 + 2 + 8 + 8 + 0 + 0 = 27
You can expect the input to be an integer above 0.
Output can b... |
[Question]
[
Since Halloween is coming up I thought I might start a fun little code golf challenge!
The challenge is quite simple. You have to write a program that outputs either `trick` or `treat`.
"The twist?" you may ask. Well let me explain:
Your program has to do the following:
* Be compilable/runnable in ... |
[Question]
[
Given a number *N*, draw a left aligned *N*x*N* board of numbers, leaving 1 blank (as a space) (I will show diagrams with *N*=5)
```
2 3 4 5
6 7 8 9 10
11 12 13 14 15
16 17 18 19 20
21 22 23 24 25
```
Your job is to construct the Sieve of Eratosthenes, step by step. First, start with 2. It'... |
[Question]
[
# Introduction
A bell tower will ring its bells every hour, `n` times, with `n` being the the current hour on a 12 hour clock.
For example, a bell will ring 5 times at 5pm, and 10 times at 10am.
# Task
Given two times in a suitable format, output the number of times the bell will ring, inclusive of t... |
[Question]
[
Given a nonempty list of positive decimal integers, output the largest number from the set of numbers with the fewest digits.
The input list will not be in any particular order and may contain repeated values.
**Examples:**
```
[1] -> 1
[9] -> 9
[1729] -> 1729
[1, 1] -> 1
[34, 3] -> 3
[38, 39] -> 39
... |
[Question]
[]
|
[Question]
[]
|
[Question]
[
So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with [hello-world](/questions/tagged/hello-world "show questions tagged 'hello-world'"), and counting). While this is not the most interesting code golf in the common lan... |
[Question]
[
In the popular (and essential) computer science book, *An Introduction to Formal Languages and Automata* by Peter Linz, the following formal language is frequently stated:
$$\large{L=\{a^n b^n:n\in\mathbb{Z}^+\}}$$
mainly because this language can not be processed with finite-state automata.
This exp... |
[Question]
[
Write a program which outputs the square root of a given number in the shortest time possible.
## Rules
It may not use any builtins or powering with non-integers.
# Input format
* as a function argument
* as a command line argument
* as a direct input on stdin or a window
Your entry hasn't to be ... |
[Question]
[
## Introduction and Credit
Today without a fancy prelude: Please implement `takewhile`.
A variation of this (on a non-trivial data structure) was an assignment at my university functional programming course. This assignment is now closed and has been discussed in class and I have my professor's permi... |
[Question]
[
>
> The challenge involve simply toggling a string within another string.
>
>
>
## Explanation
If the **toggle string** is a substring of the **main string**, remove all instances of the **toggle string** from the **main string**; otherwise, append the **toggle string** at the end of the **main s... |
[Question]
[]
|
[Question]
[
In the C programming language, arrays are defined like this:
```
int foo[] = {4, 8, 15, 16, 23, 42}; //Foo implicitly has a size of 6
```
The size of the array is inferred from the initializing elements, which in this case is 6. You can also write a C array this way, explicitly sizing it then de... |
[Question]
[
You are to approximate the value of:
$$\int^I\_0 \frac {e^x} {x^x} dx$$
Where your input is \$I\$.
# Rules
* You may not use any built-in integral functions.
* You may not use any built-in infinite summation functions.
* Your code must execute in a reasonable amount of time ( < 20 seconds on my machi... |
[Question]
[
Given a non-flat list of integers, output a list of lists containing the integers in each nesting level, starting with the least-nested level, with the values in their original order in the input list when read left-to-right. If two or more lists are at the same nesting level in the input list, they ... |
[Question]
[
## Background
Most everyone is familiar with the *Fibonacci numbers* \$F(n)\$:
>
> \$0, 1, 1, 2, 3, 5, 8, 13, 21, ...\$
>
>
>
These are formed by the recursion function \$F(n) = F(n-1) + F(n-2)\$ with \$F(0)=0\$ and \$F(1)=1\$. [A000045](https://oeis.org/A000045)
A closely related sequence is the... |
[Question]
[
Given a string with a multiple people's investment data, find out how much profit/loss they recorded.
The string only contains capital and lowercase letters, like this:
```
AABaBbba
```
Each letter represents a person - a capital letter means buy, a lowercase letter means sell. The price of the stoc... |
[Question]
[
*Inspired by [this](http://chat.stackexchange.com/transcript/240?m=26561376#26561376) conversation in chat.*
Your goal in this challenge is to emulate a ninja and count how many deaths he has left.
## Specs
You ninja starts out with 9 deaths left. He also gets an integral starting health as an input.... |
[Question]
[
The [Cheela](http://aliens.wikia.com/wiki/Cheela) (from the book [*Dragon's Egg*](https://en.wikipedia.org/wiki/Dragon%27s_Egg) by Robert L. Forward) are creatures that live on the surface of a neutron star. Their body is flat and circular with twelve eyes on the perimeter, so they naturally use a ba... |
[Question]
[
A [man from the stars](https://codegolf.stackexchange.com/users/12914/elendia-starman) has come to Earth! Luckily the president of the United States, Donald Trump, has an infinity-sided die. Using this die, he can conjure up a number which *you*, the mayor of [Podunk](http://earthbound.wikia.com/wiki... |
[Question]
[
We all know that if you google the word "google" it will break the internet.
Your task is to create a function that accepts one string and returns its length, in the fewest possible Unicode characters.
However, if the given string is `google` (lowercase), it will cause an error.
For example, `g('bing... |
[Question]
[
This serves as a catalog for tips related to golfing in [Burlesque](http://esolangs.org/wiki/Burlesque).
Burlesque is a lazy, esoteric programming language. It's mostly used on anarchy golf while popularity on Codegolf is not as high. However, this catalog is intended to be used by people golfing on ... |
[Question]
[
Write a program that counts up forever, starting from one.
Rules:
* Your program must log to `STDOUT` or an acceptable alternative, if `STDOUT` is not available.
* Your program must be a full, runnable program, and not a function or snippet.
* Your program must output each number with a separating ch... |
[Question]
[
Write the shortest program that takes one input (n) from STDIN (or equivalent) and outputs a simple incrementing function with one argument (x) that returns x + n but the function must be in a different language. Pretty simple!
**This is code-golf, normal rules apply, shortest program wins.**
Example... |
[Question]
[
Lots of people like to play music for fun and entertainment. Unfortunately, music is pretty difficult sometimes. That is why you're here!
## Task
It's your job to make reading music much easier for those struggling with it. You need to write a program or function that takes as input a musical staff, ... |
[Question]
[
# `cat` goes "Meow"
We are all familiar with the concept of a `cat` program. The user types something in, it is echoed back to the user. Easy. But all `cat` programs I've seen so far have missed one fact: a `cat` goes "Meow". So your task is to write a program that copies all `STDIN` to `STDOUT` **UN... |
[Question]
[
Using your language of choice, golf a [quine](http://en.wikipedia.org/wiki/Quine_%28computing%29).
>
> A **quine** is a non-empty computer program which takes no input and produces a copy of its own source code as its only output.
>
>
>
No cheating -- that means that you can't just read the sourc... |
[Question]
[
## Challenge
Given a list of numbers, calculate the population standard deviation of the list.
Use the following equation to calculate population standard deviation:

## Input
The input will a list of integers in any for... |
[Question]
[
Whoa, whoa, whoa ... stop typing your program. No, I don't mean "print `ABC...`." I'm talking the capitals of the United States.
Specifically, print all the city/state combinations given in the following list
* in any order
* with your choice of delimiters (e.g., `Baton Rouge`LA_Indianapolis`IN_...` ... |
[Question]
[
The cops thread can be found here: [The Mystery String Printer (Cops)](https://codegolf.stackexchange.com/questions/60328/the-mystery-string-printer-cops)
# Your challenge
* Choose a submission from the cops thread, and print out the string from an answer in that thread.
* The submission that you cho... |
[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 7 years ag... |
[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/60042/edit).
Closed 8 years ago.
[Improve this question](... |
[Question]
[
Your task is to create the shortest infinite loop!
The point of this challenge is to create an infinite loop producing no output, unlike its possible duplicate. The reason to this is because the code might be shorter if no output is given.
## Rules
* Each submission must be a full program.
* You must... |
[Question]
[
Believe it or not, we do not yet have a code golf challenge for a simple [primality test](https://en.wikipedia.org/wiki/Primality_test). While it may not be the most interesting challenge, particularly for "usual" languages, it can be nontrivial in many languages.
Rosetta code features lists by langu... |
[Question]
[
This is my first challenge, so I'm keeping it fairly simple.
If you've ever typed `telnet towel.blinkenlights.nl` on your command line and pressed enter, you will have experienced the joy of asciimation. Asciimation is, quite simply, doing an animation with ascii art. Today we will be doing a very ba... |
[Question]
[
You must evaluate a string written in [Reverse Polish notation](http://en.wikipedia.org/wiki/Reverse_Polish_notation) and output the result.
The program must accept an input and return the output. For programming languages that do not have functions to receive input/output, you can assume functions l... |
[Question]
[
You are a space tourist on your way to planet Flooptonia! The flight is going to take another 47,315 years, so to pass the time before you're cryogenically frozen you decide to write a program to help you understand the Flooptonian calendar.
Here is the 208-day long Flooptonian calendar:
```
Month ... |
[Question]
[
[NetHack](https://en.wikipedia.org/wiki/NetHack) is a roguelike game where a player must retrieve the Amulet of Yendor from the lowest level of the dungeon. Commonly played via telnet, the entire game is represented with ASCII graphics. The game is extremely challenging and requires knowledge of many... |
[Question]
[
### Task
Write a program that reads three integers **m**, **n** either from STDIN or as command-line arguments, prints all possible tilings of a rectangle of dimensions **m × n** by **2 × 1** and **1 × 2** dominos and finally the number of valid tilings.
Dominos of an individual tiling have to be rep... |
[Question]
[
This problem is from [Five programming problems every Software Engineer should be able to solve in less than 1 hour](https://blog.svpino.com/2015/05/07/five-programming-problems-every-software-engineer-should-be-able-to-solve-in-less-than-1-hour) which itself is an interesting read. The first few pro... |
[Question]
[
Here is a simple [ASCII art](http://en.wikipedia.org/wiki/ASCII_art) snowman:
```
_===_
(.,.)
( : )
( : )
```
Let's make him some friends. This will be the general pattern for our ASCII art snowpeople:
```
HHHHH
HHHHH
X(LNR)Y
X(TTT)Y
(BBB)
```
The leading spaces and the parentheses are always the ... |
[Question]
[
What general tips do you have for golfing in Python? I'm looking for ideas which can be applied to code-golf problems and which are also at least somewhat specific to Python (e.g. "remove comments" is not an answer).
Please post one tip per answer.
[Answer]
use `os.urandom()` as a random sourc... |
[Question]
[]
|
[Question]
[
The [Vigenère cipher](http://en.wikipedia.org/wiki/Vigen%C3%A8re_cipher) is a substitution cipher where the encryption of each letter of the plaintext depends on a different character in a keyword. This stops you using simple methods of frequency analysis to guess the correct substitution. However, t... |
[Question]
[]
|
[Question]
[
Your job is to write a program (or two separate programs) in any language that:
1. Can take a completed Sudoku board as input (in any logical format) and compress it into a string of characters
2. Can take the compressed string as input and decompress it to get the *exact* same completed Sudoku board... |
[Question]
[
Given a string, consisting of a prefix and then "illion", convert this number into standard form.
For example:
```
"million" -> 10^6
"trillion" -> 10^12
"quattuordecillion" -> 10^45
```
The program needs to be able to handle input going up to Centillion, which is 10^303. A list of names and their sta... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.