# All Questions

10,298 questions
637 views

### Toasty, Burnt, Brûlée!

It turns out that my toaster is a tad broken. It lost WiFi (You know, it's one of those newfangled smart toasters), and its been going bonkers! Since it no longer works, I've been having to hack into ...
3k views

### How fast am I vrooooming?

Introduction My car speedometer was hacked! Instead of showing me how fast i'm driving, it just shows: "Vroooom!" Please help me know how fast i'm going. Challenge Take a string as input, and check ...
196 views

### Find the minimal initial values [duplicate]

Consider a sequence F of positive integers where F(n) = F(n-1) + F(n-2) for n >= 2. The ...
357 views

### Count cyclically self-describing lists

Cyclically self-describing lists A list $L$ of positive integers is cyclically self-describing, if the following conditions hold. $L$ is nonempty. The first and last elements of $L$ are ...
2k views

### Repeat this GCD operation

Problem A3 from the 2008 Putnam competition says: Start with a finite sequence $a_1, a_2, \dots, a_n$ of positive integers. If possible, choose two indices $j < k$ such that $a_j$ does not ...
3k views

### My array should equal this, but it doesn't!

Given an array of integers a which contains n integers, and a single integer x; remove the fewest amount of elements from ...
1k views

### Numbers Manipulation challenge

Use any programming language to generate two random digits between 1 and 9 (including both). Then your program should display: in the first line: the first random digit, in the second line: the ...
556 views

### 0xDEADBEEF is not tasty, but still 0xFEEDBEEF

Inspired by "You had me at hello" Introduction For those who don't know, hexadecimal is a base system like decimal. Contrary to decimal however, it uses 16 (hence the name) digits instead of 10. ...
107 views

### x bottles of y on the z [duplicate]

I do not believe this question to be a duplicate of this one, since this one requires more string manipulation, if it is still a duplicate feel free to close this question Introduction Your ...
4k views

### A “Sorting” algorithm

There is a "sorting algorithm" sometimes called Stalin sort in which in order to sort a list you simply remove elements from the list until it is sorted in increasing order. For example the list <...
821 views

### Decimal Digit Truncating

Input: A decimal Output: The input truncated How to truncate them? The integer part of the input will remain the same. The decimal part of the input will be truncated based on the lowest digit in ...
107 views

### StalinSort Golf [duplicate]

Someone sent me this description of a joke sorting algorithm, and I thought it would make for a fun golf. Given a list of positive integers remove all elements that aren't larger than all elements ...
6k views

### Is this number secretly Fibonacci?

Background Most of you know what a Fibonacci number is. Some of you may know that all positive integers can be represented as a sum of one or more distinct Fibonacci numbers, according to Zeckendorf'...
156 views

### Seeking Substantial Subcollections

(thanks to @JonathanFrech for the title) Challenge Write a program or function that, given a collection of positive integers $S$ and a positive integer $n$, finds as many non-overlapping ...
2k views

### Split it. But not all!

Inspired by this StackOverflow question. Input: We'll take three inputs: A delimiter-character D to split on A character I ...
200 views

### Find the pattern

I feel tired to do "find the pattern" exercise such as 1 2 3 4 (5) 1 2 4 8 (16) 1 2 3 5 8 (13) Please write a program that finds the pattern for me. Here, we ...
299 views

### Is the Circuit Possible?

Write a program or function that takes input: all resistors available and a resistance value and outputs a truthy value of whether or not it is possible to get the resistance by using those resistors. ...
513 views

### Hack g-code.js parser

Here you can see g-code parser, written in JavaScript to use in microcontroller (like espruino). But you can run it in browser, because it don't use any specific features. ...
278 views

### convert decimal to duodecimal

The task is to convert a string representing a number in decimal (base 10) representation to duodecimal (base 12). The input is thus a string, the output should be printed. The input number can be ...
2k views

### Trim that distracting background off!

Isn't it annoying when you're taking a picture, but the background detracts from the actual substance of the image? I'd say it is. I need to know how much I should crop so that I get rid of this ...
255 views

### Sequence and Series

Use any programming language to display numbers divisible by 1000000 that are greater than 1 and less than 10000000. Each number should be displayed in new line. Your program should display exactly: <...
102 views

### Minimum 1's to get 1-expression for n [duplicate]

Background Challenge is inspired by this question. The 1-expression is a formula that in which you add and multiply the number 1 any number of times. Parenthesis is allowed, but concatenating 1's (e....
361 views

### Optimize my wings order

This tweet lists the possible orders for Wings of a Chinese restaurant1: When ordering Pizza I usually calculate what size gives me the best Pizza-price ratio which is a simple calculation. However ...
1k views

### Find a recursive acronym

Introduction A recursive acronym is an acronym that contains or refers to itself, for example: Fish could be a recursive acronym for ...
3k views

### Chop up my ASCII art

Let's say I've got some ASCII art: ...
3k views

### Bake me a slice of cake

My birthday is in a month, and this is a slice of tasty cake. ...
1k views

### New Neighbour Sequence

The non-negative integers are bored of always having the same two* neighbours, so they decide to mix things up a little. However, they are also lazy and want to stay as close as possible to their ...
251 views

### Choose the Most Dramatic Outcome

The premise of this is simple: A 10% chance is pretty unlikely, but everyone knows that a one-in-a-million chance is a sure thing! So, write code that implements the following "dramatic" probability ...
455 views

### Smoothing a pair of arrays

Input Two lists with binary values (list_a, list_b) of equal length=>3. Output Two lists with binary values ...
4k views

### Read out the C variable declaration

Background Variable declaration statement in C consists of three parts: the name of the variable, its base type, and the type modifier(s). There are three kinds of type modifiers: Pointer ...
379 views

### Array indexes to number and number reversed

Given an input array having minimum length 2 and maximum length 9 having any initial values output an array having length ...
3k views

### Playing with the musical turtle

My two kids like to play with the following toy: 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 ...
401 views

### Html Indentation

Given an inconsistently indented piece of html code your task is to return the same text but correctly indented Indent space = 4 Assume input will be non-empty. Input can be taken as string or array/...
446 views

### What Inning is it?

Goal In light of the World Series being around the corner, I need a program that can read the box scores and tell me what inning it is. This is complicated slightly because baseball uses an odd ...
2k views

### The Written Digits Sequence

Here's a reasonably trivial sequence which is not in the Online Encyclopedia of Integer Sequences. Start with an empty sequence then define each term as the number of characters required to write out,...
443 views

### Validate a barcode [duplicate]

A barcode of EAN-13 symbology consists of 13 digits (0-9). The last digit of this barcode is its check digit. It is calculated by the following means (the barcode ...
210 views

### Find the closest RGB color [closed]

Input: A valid 6 HEX digit color code wihout a # prefix Valid: 000000 FF00FF ABC123 Your job is to find to which one of these: ...
8k views

Your network scanning tool is annoyingly picky about input, and immediately crashes if you feed it an IPv4 address that contains improper characters or isn't properly formatted. An IPv4 address is ...
2k views

### Let's play tennis 2: east-west game

There is a challenge Let's play tennis by Daniel. He proposes to place a court in the North-South direction. My proposal is to create a court to play tennis in the East-West direction too. You ...
3k views

### Decode a 7-segment display

You probably all know the 7-segment display which can display among other things all digits from $0\dots 9$: Challenge We only consider the segments $\texttt{A}\dots\texttt{G}$, your task is to ...
456 views

### Count arrays that make unique sets

This question has a similar set up to Find an array that fits a set of sums although is quite different in its goals. Consider an array A of length ...
179 views

### Maximize Sudoku King's tour

Background Sudoku is a number puzzle where, given an $n \times n$ grid divided into boxes of size $n$, each number of $1$ to $n$ should appear exactly once in each row, column and box....
1k views

### Given a string, calculate the number of the column it corresponds to

In Excel, the columns range from A-Z, AA,AB,AZ,BA,..,BZ and so on. They actually each stand for numbers, but rather are encoded as alphabet strings. In this ...
694 views

### Add All Permutations of a Number

You have to make something that takes in one input from a default I/O method (as an integer), and prints out the sum of all the permutations of that number (not necessarily unique) For example: <...
793 views

### Is this string a palindrome (in Morse Code)?

Challenge Inspired by this video As you may know, a palindrome is a word that is spelled the same forward as it is backward. The word "PULP" is not a palindrome, but when translated into Morse Code (...
2k views

### Is this a BST pre-order traversal?

Background A binary tree is a rooted tree whose every node has at most two children. A labelled binary tree is a binary tree whose every node is labelled with a positive integer; moreover, all ...
787 views

### Find an array that fits a set of sums

Consider an array A of length n. The array contains only positive integers. For example ...
459 views

### Convert an ASCII art table to a UTF-8 table

When I write documentation, comments, etc. I love making ASCII tables. They usually end up looking pretty good, but I always feel that they could look even better - especially since UTF-8/Unicode ...