Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [restricted-source]

Imposes a restriction on the source code used to solve the challenge, for example, having no numbers in the source code.

4
votes
49answers
6k views

Find the absolute value of a number without built-in functions [closed]

The challenge is to take any real number as input and output or return the absolute value. You may not use any built-in functions other than those dealing with input and output/returning. This is code ...
-2
votes
1answer
452 views

Bitwise GCD Challenge

Write the shortest iterative function to find gcd of two numbers (assume 32 bit numbers). Rules: Arithmetic, Comparison and Logical Operators are not allowed (except equality comparison (...
7
votes
5answers
650 views

Shortest Mirror Quine Challenge [closed]

Find the shortest mirror quine in a language of your choice. A mirror quine is a quine whose source code is equal to the reverse of its own source code. Note: 1) Length of source code should be ...
-6
votes
14answers
773 views

Sort, with your hands tied behind your back [closed]

The problem is very simple: write a program that accepts a single unsigned integer from the command line, and prints out that many random numbers on the standard output, in ascending order. For ...
70
votes
111answers
14k views

Print the alphabet without using each vowel

Inspiration: in 1939, a man named Ernest Vincent Wright wrote a novel called Gadsby without using the letter 'e'. Your task is to write a set of (up to 5) programs in any language (which has a text-...
5
votes
13answers
855 views

Generate the list [1, 0, -1, 0, 1, 0, -1, 0, …] [closed]

In the spirit of a question on math.se: given an integer n, return the integer in position n of the sequence [1, 0, -1, 0, 1, 0, ...
31
votes
66answers
6k views

Determine if a number is divisible by 13 (without using 13 itself) [closed]

Your challenge, should you choose to accept it, is to create a function or a program that outputs "yes" if a given number is divisible by 13 and outputs "no" if it isn't. Rules: - You're not allowed ...
23
votes
44answers
4k views

Adding without using a + or - sign

There have been many "Do __ without __" challenges before, but I hope that this is one of the most challenging. The Challenge You are to write a program that takes two natural numbers (whole numbers ...
22
votes
25answers
6k views

Look and say sequence [duplicate]

The look and say sequence is a basic form of run length encoding. The sequence starts with the number 1 and each additional number encodes the number of digits that are repeated before each digit ...
14
votes
17answers
4k views

Shuffle a deck without local variables [closed]

The object of this puzzle is to take a deck of 52 cards and shuffle it so that each card is in a random position. Given: An array, deck, of 52 distinct integers ...
77
votes
97answers
12k views

Hello World 0.0!

source: Dilbert, September 8, 1992 I'm hoping to add a new twist on the classic "Hello World!" program. Code a program that outputs Hello World! without: String/...
8
votes
17answers
3k views

Multiply without multiply [closed]

Write the fastest (best big-O) and smallest multiplication algorithm for positive integers, without using multiplication operators. You are only allowed addition, subtraction, logical functions (AND, ...
25
votes
10answers
3k views

Calculate 500 digits of pi

Write a program to calculate the first 500 digits of pi, meeting the rules below: It must be less than 500 characters in length. It cannot include "pi", "math.pi" or similar pi constants, nor may it ...
6
votes
8answers
415 views

Remainder When N divided by 2^M

Write the shortest code to find the remainder when an input number N is divided by 2^M. You cannot use /,* and % operator. ...
119
votes
119answers
35k views

Obfuscated Hello World

Create the shortest possible obfuscated program that displays the text "Hello World". In order to be considered an obfuscated program, it must meet at least two of the following requirements: Does ...
25
votes
17answers
8k views

Print 1 to 1000 in C++ without semi-colons

Following this popular question, present your solution which prints the numbers 1 to 1000 (all of them, not the string "1 to 1000" verbatim or something funny) in C++ without using any semi-colons. ...
50
votes
41answers
15k views

Obfuscated FizzBuzz Golf [closed]

Create the shortest possible obfuscated FizzBuzz implementation. To be considered obfuscated, it should satisfy at least one of the following: Does not contain any of the words "Fizz", "Buzz", or "...