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.

15
votes
6answers
711 views

Print strings without sharing characters

Edit: Allowed to reuse whitespaces. Your task is to write n programs (or functions, or bodies of functions without using parameters or the function names) in the same language. The kth program ...
35
votes
50answers
6k views

Capitalize first letter of each word of input

This is a relatively quick one, but I'm sure you'll like it. Codegolf a program that will take input in the form of a sentence and then provide the output with the first letter capitalized in each ...
16
votes
6answers
435 views

Princely Prefix by a Program in Pattern

You should write a program or function which outputs or returns as much of Chapter I of The Little Prince as it can. Your program or function has to be an M-by-N block of code containing only ...
28
votes
4answers
3k views

Quick! Escape the black hole!

It is the year 87,539,319 and solitary space-walking is now commonplace, many people travel into space by themselves, propelled by nothing but a jetpack on their backs, programming their course with a ...
7
votes
4answers
813 views

Write an URL compressor

Today your goal is to invent URL compression. You must write two programs: a compressor and a decompressor. The compressor will be called with one URL on stdin and its output will be read on stdout. ...
16
votes
5answers
639 views

Unwise bit operations

I like to golf in dc, but I'm sometimes frustrated because dc doesn't have bitwise operations. Challenge Provide four named ...
-3
votes
5answers
1k views

Print the Longest Sentence

I've searched around, and cannot find a challenge too similar to this one--however, it would not surprise me if this is not the first of its kind. My apologies if I've overlooked something. The ...
27
votes
18answers
6k views

Shortest Sorted Hello World

Write a program that takes no input and prints Hello, World! to stdout or your language's closest alternative. The catch is that each line in your program must only ...
11
votes
4answers
747 views

Encoding an URL in brainfuck

Inspired by this question, your goal today is to encode an URL in brainfuck. My browser has been hacked! The location bar has been turned into a brainfuck interpreter. I need a program that turns an ...
2
votes
7answers
365 views

42 in Rod Logic

Write the shortest possible program which takes a numeric input and outputs the result of adding 42 to the input. f(x) -> x + 42 There's only one restriction. ...
11
votes
8answers
901 views

Generate a Brainf_ck program that outputs a string of given length

Your friend is trying to break into a vault that has a peculiar locking system: it requires a certain number of gentle knocks in a particular spot. Your friend discovered the number (which is in the ...
22
votes
27answers
2k views

Palindromic palindrome generator

Create a program, that converts input string to a palindrome starting with the input string. The program itself must be a palindrome. For example input: neverod, ...
40
votes
8answers
5k views

Write a Quine in Plain English

Write a quine that consists of real English words separated by single spaces. A "word" is defined as a string containing only lowercase and uppercase letters (...
9
votes
2answers
815 views

Finding Programs in the Primes

Let's assign the numbers 0 through 94 to the 95 printable ASCII characters: ...
22
votes
2answers
840 views

Help me procrastinate on my computer repairs!

This challenge is brought to you by real (and tragic) inspiration. Recently, the number row on my keyboard has been a bit sporadic. The keys 1-9 work sometimes--but ...
21
votes
9answers
3k views

Finding prime numbers without using “prime characters”

Your task, if you choose to accept it, is to write a program/function that accepts an integer N as input. The program/function should output/return a list of the first N prime numbers. But here's the ...
-3
votes
4answers
167 views

Extract URI parts without using libraries [closed]

Given a URI like: postgres://username:password@hostname:PORT/dbname Extract it all into an array data-structure, like so: ...
1
vote
1answer
196 views

Printing a “Hello World” one-liner in bourne shell without directly using white space char [closed]

I'm currently trying to solve a tricky/silly challenge and i've come to a dead end. The challenge is basically to form a one-liner /bin/sh compatible command line which essentially outputs "Hello ...
-2
votes
2answers
106 views

Print the content of /etc/passwd with constant creation limit [closed]

Rules/Objectives: The program must be executed using ./program-name without shell parameter/arguments. the program-name may not ...
-3
votes
5answers
164 views

Shortest code special string sort

Objective/Restrictions: May only be answered with programming language that has function syntax (or procedure, method, lambda, macro, statement grouping and labelling) . Create a function with at ...
4
votes
0answers
91 views

Resistent counter [duplicate]

You just have to ouput exactly all the numbers from 1 to 10 separated by spaces. Your programme should work all the times even if a random character is deleted before compiling/interpreting. This is ...
1
vote
1answer
90 views

Implement range function without using numbers in code [duplicate]

You have to create a function range, such that it takes two (integer) arguments a and b (<...
8
votes
36answers
4k views

Calculate the square of an integer with restrictions [closed]

The Puzzle You have to write a program or function p(n) that returns the square of what is entered into it and you may assume that the input is a non-negative integer. Put in simpler terms, return n2....
23
votes
14answers
2k views

Recycling for the New Year

A good resolution for 2015 is to live more sustainably. We'll start by recycling. Recycling code, that is! Your task is to print the number 2015 to STDOUT, with or ...
47
votes
61answers
13k views

yes is 91 lines long

yes, from coreutils, is 91 lines long. Many of them are comments, but that is still WAY too long. Write a program that imitates ...
-5
votes
28answers
1k views

Produce the word 'codegolf' without using any of its characters in code [closed]

You need to produce the word codegolf Rules: None of the characters of the word codegolf (i.e. 'c', 'o', 'd', 'e', 'g', 'o', 'l' and 'f') in either case can ...
53
votes
23answers
6k views

Significant Whitespace

We define whitespace to be any of the three characters, tab (0x09), newline (0x0A) or space (0x20). For this challenge, you're to write two programs or functions in the same programming language, ...
19
votes
3answers
2k views

Distinguish between Masculine and Feminine Nouns in French within 100 characters

You are to write a very small program within 100 characters. Your program must distinguish between masculine and feminine french nouns. The output should be un if ...
1
vote
4answers
493 views

Use threes to count the threes!

Write a program or function that takes two numbers - x>3 and n>0 - as input, and finds all possible bases ...
24
votes
24answers
4k views

Shortest Minmod Function

The minmod function is a variant of the familiar min, which appears in slope-limiting high-resolution schemes for partial differential equations. Given a number of slopes, it picks out the flattest ...
30
votes
12answers
3k views

Say Hello to the Pioneers of Computer Science

Choose your favorite famous computer scientist or computer science pioneer who was born in 1942 or earlier (as 1943 marks the start of the creation of the 'first' computer). They should have a ...
1
vote
0answers
370 views

Implement multiplication without using any loops, branches or function calls [closed]

I came up with the following in GNU C r=0;m(a,b){x:goto*(int*[]){&&x,&&y}[r+=a&1?0:b,a>>=1,b<<=1,a<1];y:;} One could argue ...
20
votes
4answers
2k views

The Fatal Error Challenge

Objective Write a routine that accepts a string of printable ASCII characters, s, and returns a string containing the same characters as s, reordered so that no two-character substring appears more ...
7
votes
2answers
412 views

Calculate a pi-based sequence with a pi-based frequence

Introduction Pi is 3.1415926535897932384626433832795028841971693993751058209749445923078164062862089... Let's treat each digit as an instruction as to how to ...
119
votes
95answers
20k views

ASCII's 95 Characters…95 Movie Quotes

Update: The winner has been decided, but the challenge is not over! Finally, nearly 3 months after the question first started, someone has remained the last answerer for more than a week! ...
30
votes
16answers
6k views

Multiply two numbers without using any numbers

You are given as input two strings representing positive integers in base 10, such as "12345" and "42". Your task is to output a ...
61
votes
56answers
8k views

Write lines in detention

Introduction Bad news guys - you got detention. Your English teacher doesn't understand this site and wants you to "stop doing math on your digital dohickeys, this is English class!" She sentenced ...
39
votes
14answers
5k views

Programming with a Sporadic Shift Key

There's something wrong with your keyboard. The Shift key has a mind of its own. Every time you type a character you have no idea whether it will come out shifted or not (though it is 50-50). Besides ...
23
votes
8answers
2k views

Prolific Perfect Pangram Programs Pertaining to Printable ASCII

Updates: Time limit removed. You must be able to describe output - see new rule. A pangram is a sentence that uses every letter in the alphabet at least once, such as: The quick brown fox jumps ...
8
votes
2answers
901 views

¿Yo Quiero jQuery?

The Setup You are given a simple web page with 11 elements: 10 input elements with IDs i1 thru ...
20
votes
11answers
1k views

Restricted Polyglot

Polyglots are programs that are valid in multiple programming languages simultaneously. Most such polyglots are written in such a way that certain constructs of one language are interpreted as ...
7
votes
4answers
3k views

Un-hash the Java Hash

Hash Un-hashing The basic goal of this challenge is to exploit the high probability of collision in the Java Hash function to create a list of plausible inputs that created an outputted hash. The ...
22
votes
14answers
3k views

Un-round fractions

When you convert a fraction to a decimal number and you want to store that number, you often have to round it, because you only want to use a certain amount of memory. Let's say you can only store 5 ...
12
votes
14answers
9k views

Compare two integers in C or C++ without comparison operators

Produce the shortest program which takes two signed integers as input (through stdin or as arguments) and displays 3 different outputs depending upon whether the first number is (1) greater than, (2) ...
40
votes
4answers
2k views

Multiply with restricted operations

Goal Your goal is to multiply two numbers using only a very limited set of arithmetic operations and variable assignment. Addition x,y -> x+y Reciprocal <...
17
votes
10answers
2k views

The Symbols vs. The Letters

The Symbols vs. The Letters The ASCII characters have been divided once again! Your sets are The Letters and The Symbols. The Letters ...
-5
votes
4answers
892 views

Convert to uppercase and lowercase without branching and comparisons

Write two functions/programs which take an ASCII code of character (8-bit unsigned integer) and one of them converts char to uppercase and other to lowercase. That is, they must be equivalent to ...
6
votes
6answers
4k views

Solve quadratic equation using only 3 variables and arithmetic

Write function which solves equation of degree less than or equal to 2 (ax^2 + bx + c = 0). Input Function should get 3 parameters - floating point numbers which ...
42
votes
14answers
7k views

What's the shortest contiguous subset of ASCII you need to output the rest?

The printable ASCII characters (hex codes 20 to 7E) in order are: ...
12
votes
5answers
825 views

Raise to the Power

Challenge Challenge is writing a program that takes a positive numbers a and a nonzero number b and outputs ...