All Questions

Filter by
Sorted by
Tagged with
4
votes
6answers
928 views

Count how many numbers are divisible by perfect numbers in a given range

Given two arbitrary integers a and b. Count how many numbers are divisible by perfect numbers in that given range (a and b both are inclusive). In mathematics, a perfect number is a positive ...
21
votes
3answers
1k views

Singular or plural?

Here is a list of 30 English nouns in their singular and plural form. Your job is simply to write the shortest regular expression that matches all the nouns in one form and none in the other (easy, ...
26
votes
6answers
1k views

Wikipedia: Philosophy!

As many geeks may know most pages (95% i think) on wikipedia eventually lead to Philosophy like this: Click on the first non-italic or in parentheses link that is to another normal article: (i.e. not ...
28
votes
6answers
8k views

Let's draw the flag of Nepal

Nepal’s flag (Wikipedia, Numberphile) looks very different from any other. It also has specific drawing instructions (included in the Wikipedia article). I want you guys to make a program which will ...
0
votes
4answers
951 views

Regex - Match half of the strings

Okay, the challenge is that you have to write a regex that matches half of all strings. Some rules to clarify: For ANY string length(>0), if I permute all strings(of that length), exactly half of ...
42
votes
38answers
6k views

Print a sinusoidal wave (vertically)

Print a continuous sinusoidal wave scrolling vertically on a terminal. The program should not terminate and should continuously scroll down the wave (except until it is somehow interrupted). You may ...
12
votes
1answer
1k views

Find number of rectangles in a 2D byte array

...
15
votes
12answers
2k views

Create Balanced BST from Sorted List of Integers

Given a unique, sorted list of integers, create a balanced binary-search tree represented as an array without using recursion. For example: ...
31
votes
5answers
1k views

One Line Aquarium

My parents-in-law have a fishpond in their yard, filled with koi. It didn't really cross my mind until I noticed the following extract from my code. ',') & '_' ...
8
votes
9answers
1k views

Find the largest contiguous prime in a string

In fairness, this is based on a StackExchange question - but its a good question. The challenge is fairly simple: Take a string of numerals Find and print the largest contiguous prime number in the ...
38
votes
86answers
12k views

Count sum of all digits

This challenge is to write a program or script which counts the sum of all digits within the integers from 1 up to and including a given number. Input, one positive integer. Output, the sum of digits ...
34
votes
4answers
2k views

Flippin' Squares

Create a program or function to unjumble a square of digits by flipping (reversing around the centre point) only rows and columns. Input Input will be a 9x9 grid of digits in the form of a 9 line ...
27
votes
1answer
2k views

Find the beats in an MP3 file

In this challenge, your task is to take an simple recording in mp3 format and find the time offsets of the beats in the file. Two example recordings are here: https://dl.dropboxusercontent.com/u/...
16
votes
7answers
1k views

Period of the decimal representation

Write a function which takes a single positive integer n and returns the period of the decimal representation of 1/n. Test cases: ...
6
votes
5answers
4k views

Convert radicals to mixed & entire radicals and to real numbers [closed]

Challenge The goal of this challenge is to take a radical and convert it to a reduced and entire radical, and a real number. You do not have to convert it to all 3, however, you will get bonus points ...
6
votes
6answers
923 views

Write the longest program that prints the date of tomorrow

I would like to propose a new kind of challenge: Anti Code Golf! (as anti-golf, not anti-code). The idea is to write the longest program you can write to do something. That would be Code Bowling, as ...
3
votes
6answers
445 views

Compute every combination of operations written in a .TXT file

Your task is to create a program that computes every combination of the operations written in a .TXT file. Example TXT File: 1 + 2 / 3 Example Output: ...
0
votes
8answers
560 views

Create a programs that counts the 0's in numbers from 0 to a billion [duplicate]

This will be my very first post on stackexchange so bear with me. Create a program that counts from 0 to 1,000,000,000. Now the trick is to not print all these characters but to only print how many ...
11
votes
4answers
1k views

Build a deterministic Go AI

Here's an interesting problem I thought of the other day, which involves bits of code competing against other bits of code not just in a property that the code has, but by playing a game against those ...
3
votes
1answer
450 views
6
votes
9answers
2k views

Shortest C \ C++ function to generate -1, 0 ,1 [closed]

Let a function receive two integers i and j between 0 and ...
3
votes
7answers
256 views

Output and sourcecode lineup

General constraints: Your program should not take any input. Your program should output words, 1 word/line. Only capital letters (A-Z) in the output. A word must be atleast 2 letters in length. A ...
60
votes
23answers
14k views

Shortest unmatchable regular expression

Your mission is to write the shortest valid regular expression that no string can match, empty string included. Submissions must have this form ("literal notation"): ...
12
votes
11answers
1k views

Minimum perimeter of an area [duplicate]

Just a simple code golf function for fun, intentionally left open with few rules to see what creativity comes up. Input: An integer representing the area of a rectangle. Output: Two integers ...
2
votes
5answers
684 views

Produce a palindrome from this text

Copy and paste or curl this text: http://lorem-ipsum.me/api/text Using any language make the text palindromic. You may remove letters. You may rearrange letters. ...
8
votes
1answer
709 views

Create self-extractor script (relaxed rules)

This is the target language-relaxed version of Generate a self-extractor application Create a program in any language, that takes an arbitrary binary input, and generates a valid program (also in any ...
1
vote
5answers
1k views

Lua: Render a chess board in smallest code

I'm creating a simple challenge here as a first test of the community's reactions. Please let me know if this challenge is the kind of thing you guys like or what I can improve... :) The task is this:...
6
votes
10answers
1k views

Alternating sort

Given a list of pairwise distinct integers, sort it in alternating order: The second number is larger than the first, the third is smaller than the second, the fourth is larger than the third etc. (...
9
votes
4answers
654 views

Find the next “interesting” time

I happened to glance at my watch today at exactly 11:11:11 (and today is 1/11; too bad it's not 2011), and that got me thinking: I know! I should make a code golf question out of this! I'm a dork. ...
68
votes
46answers
70k views

How to write a C program for multiplication without using the * and + operators?

Is it possible to write a C program that multiplies two numbers without using the multiplication and addition operators? I found this on Stack Overflow. Please help this poor programmer with his ...
14
votes
1answer
2k views

JavaScript load and SHA-256

This is a code golf puzzle with a real-world application. Some current browsers, if you enter a URL that looks like ...
6
votes
5answers
1k views

Turtle Graphics Program

Most of you have probably heard of the famous Turtle Graphics program, initially made popular by Logo. This challenge is to implement a Turtle Graphics program in your language of choice. Rules: ...
8
votes
20answers
2k views

Reciprocal Fibonacci constant

Seeing as there have been an awful lot of normal Fibonacci challenges, I decided that it might be interesting to calculate the Reciprocal Fibonacci constant - namely, the sum of the reciprocals of the ...
18
votes
12answers
2k views

I know you, but you don't know me

You're tasked with writing two programs. Program A must print out nothing on all inputs except when program B is input, in which case it should print 1. Program B ...
-1
votes
3answers
754 views

1+2+3+4+…+n = -1/12? [duplicate]

Today, Numberphile posted this video where it's stated that 1+2+3+4+...+n = -1/12. While this isn't really new (several ways to prove that have been found, you can ...
6
votes
7answers
5k views

Count the Zeros

For a given n, count the total number of zeros in the decimal representation of the positive integers less than or equal to n. For instance, there are 11 zeros in the decimal representations of the ...
39
votes
49answers
7k views

Write an aphorism using valid code [closed]

Can you write an aphorism in at most 4 lines of code ? Code should read as much as possible as an aphorism in plain English and should return the boolean true. ...
0
votes
1answer
2k views

Ascii art hangman [duplicate]

Although there was a hangman competition before, I don't feel it was beautiful enough. The challenge is to implement a clone of http://inventwithpython.com/chapter9.html but as in the previous ...
5
votes
14answers
773 views

Shortest string expressions stable under deleting quotes

Forgetting quotes can lead to certain problems. For example, in Scala the two expressions: "("+("+")+(")+(")+")" ("+("+")+(")+(")+") differ only in starting and ...
13
votes
3answers
2k views

Write a brainfuck compiler

Write a program that takes a brainfuck program and compiles it to executable machine code. You can target x86, x86_64, jvm (java bytecode) or armv6, and use one of the following executable formats: ...
13
votes
7answers
2k views

Morse code to standard output

This question involves taking input in Morse code as . (period) and - (minus symbol), with spaces to separate the input. Your task is to convert the code to standard output. You can assume that the ...
118
votes
73answers
25k views

Largest Number Printable

Your goal is to write a program that prints a number. The bigger the number, the more points you'll get. But be careful! Code length is both limited and heavily weighted in the scoring function. Your ...
3
votes
3answers
449 views

Regex for Finding Non-Radioactive Elements

Find the shortest regex that matches all non-radioactive elements and nothing else in the Periodic Table of Elements. This is the inverse of Regex for Finding Radioactive Elements Radioactive ...
6
votes
1answer
386 views

Manipulate “RELATIVE” using 8 OP-codes

Rules: Your program can be in any programming language. Your program should not take any input. Your program should transform the word "RELATIVE" into "STATIC". The word can at any stage only consist ...
10
votes
4answers
665 views

Regex for Finding Radioactive Elements

Find the shortest regex that matches all radioactive elements and nothing else in the Periodic Table of Elements. Radioactive Elements ...
5
votes
18answers
6k views

Sum of Numbers of Array [closed]

Given an array (N) of integers, check if it is possible to obtain a sum of S, by choosing some (or none) elements of the array ...
2
votes
9answers
2k views

Circular shift an arbitrary byte-array bitwise

Given an arbitrary array of octets, and an offset measured in bits, the goal is to bitwise left rotate the array by the specified number of bit positions as if the entire array were a single ...
20
votes
3answers
3k views

JSFuck Golf - Hello World

JSFuck is an esoteric language in which any Javascript statement can be accurately reproduced into another valid Javascript program that uses only the 6 characters ...
11
votes
7answers
529 views

Code Golf: Directory Tree -> Tree

Contest (!): In the language of your choice, write a program that will traverse the directory tree of a given directory and output a tree (i.e., an array of arrays) corresponding to it. Assume the ...
3
votes
3answers
1k views

Thinking inside the circle

In as few characters of code as you can, create an algorithm which will pack the least number of rectangles necessary to completely fill a rasterized circle with integer radius r and return the ...

15 30 50 per page
1
204 205
206
207 208
233