All Questions

Filter by
Sorted by
Tagged with
-3
votes
1answer
510 views

Raytracer in odd or high level language [closed]

Ray tracers are easy to write. At each pixel on the screen, you shoot a ray into the scene and see what it hits. For the most basic ray tracer, the ray acquires the color of the object it hit. If ...
3
votes
0answers
406 views

Create a server in Brainfu*k [closed]

Create a brainfu*k program that can act like a simple server. It will be given a JSON representation of a file folder to serve from. It'll look something like this: ...
7
votes
11answers
3k views

Convert a decimal to a fraction

Write a program that converts a decimal to a mixed, simplified fraction. Sample input: 5.2 Sample output: 5 + (1/5) The ...
0
votes
1answer
136 views

Random literal number [duplicate]

I took inspiration from a challenge I did some years ago in a programming competition. Your goal is to write a function that generates a random integer number between 0 and 150 (included), and then ...
0
votes
2answers
599 views

ROT13 one ASCII character [duplicate]

This kind of question has been asked before, but I wanted to make it more specific. The linked question asks to read from stdin and rot13 the input. I don't want the disadvantage of I/O code that ...
1
vote
4answers
292 views

Creating a catalogue index

You have a program which creates an index for a catalogue. The last step is missing: it must find and consolidate page ranges within the list of pages for each entry. Each entry is currently an ...
19
votes
12answers
1k views

Determine if land is fully enclosed by fences

Imagine a two-dimensional array of boolean values, where the 0s represent squares of grass on a rectangular plot of land and the 1s represent fences. Write a function that accepts the 2D array as an ...
4
votes
1answer
474 views

write an “operating system” that dims Num Lock

I want to write x86 assembler code that can be used to boot your computer from and dims NumLock. This means you cannot rely on glibc or any other of these "comfi" libraries you cannot rely on the ...
3
votes
3answers
988 views

Self-contained hello-world program

I want a program that outputs "hello world" on console on my x86_64 based Linux computer. Yes, a complete program, not something silly that needs an interpreter or a compiler to work. You may: use ...
15
votes
16answers
32k views

Array Merge without Duplicates

I recently saw this Javascript code on StackOverflow for merging two arrays, and removing duplicates: ...
12
votes
8answers
827 views

How long does it take to paint a stick?

(Based on this Math.SE problem, which also provides some graphics) I have a stick which looks kinda like this: I want it to look kinda like this: I'm not an expert painter, however, so before I ...
17
votes
1answer
3k views

Hide evil code - print files containing a given string anywhere in a directory tree [closed]

The point of this puzzle is to learn how a malicious code can be hidden and discovered in a program. A person is asking the question: Plz give me some code that how can I search a file may be in ...
10
votes
9answers
968 views

Helping the Farmer

Farmer Jack is very poor. He wants to light his whole farm but with minimum of cost. A lamp can illuminate its own cell as well as its eight neighbors . He has arranged the lamps in his field but he ...
8
votes
26answers
1k views

Halt with 50% non-Halting

Create a program that halts exactly 50% of the time. Be original. Highest voted question wins. By exactly I mean that on each run there is a 50% chance of it halting.
3
votes
3answers
3k views

Solve Any Motion Physics Problem (Equations Supplied)

Physics Challenge This program should be able to solve for ANY two of the following variables the user wants to solve. s (displacement) v (velocity) u (initial velocity) a (acceleration) t (time) ...
586
votes
283answers
217k views

Produce the number 2014 without any numbers in your source code

Note to challenge writers as per meta consensus: This question was well-received when it was posted, but challenges like this, asking answerers to Do X without using Y are likely to be poorly ...
0
votes
4answers
323 views

The most pointless shell command you can concoct, based upon a often used shell command [closed]

Let's waste some time coming up with stupid ideas which are close cousins of good ideas. Your useless command doesn't have to fit any minimum or maximum length. Do, however, try to turn it into a one-...
15
votes
5answers
1k views

Implementing the SHA-1 hash algorithm

The goal of this code-golf is to create a program that takes a string as input, and you have to output the SHA-1 hash value as a hexadecimal number. You can find the pseudocode for SHA-1 here Other ...
12
votes
23answers
2k views

An improved version of GolfScript [closed]

I am planning to write an improved GolfScript for even shorter programs that can do more things. This is not a challenge; it is a request for feedback and tips on what I should do. (see tags) I'm not ...
3
votes
6answers
293 views

Pascal's Trapezoid [duplicate]

Write a function which for any given input array of numbers and a row number r, returns the r-th vector or array where each subsequent vector or array is constructed from the previous following the ...
7
votes
5answers
409 views

Make a package manager

It's time to make a more advanced program (rather than something simple, like printing some shape). You need a package manager for something, I guess. First of all, if something wasn't defined, you ...
11
votes
4answers
821 views

Rosetta Stone Challenge: Gene Mapping

The goal of a Rosetta Stone Challenge is to write solutions in as many languages as possible. Show off your programming multilingualism! The Challenge Your challenge is to implement a program that ...
10
votes
5answers
1k views

Just Another Polyglot Hacker! [duplicate]

Make a program which prints just another #{LANG} hacker where #{LANG} is the name of the language with which the program is ...
7
votes
7answers
571 views

Find all Perrin pseudoprimes less than 100 million

Simply put, the Perrin sequence has the following recurrence relation: P(n) = P(n-2) + P(n-3); P(0) = 3; P(1) = 0; P(2) = 2; But wait!! There's more!! The Perrin sequence has a very bizarre property:...
10
votes
3answers
1k views

Let's simulate a random snowflake

I saw this question on https://mathematica.stackexchange.com/ and I think it's pretty cool. Let's make the snowflake with other programming languages. This is a quote from the original question: '...
19
votes
15answers
2k views

Write a function that tells you which TWO of its lines has been removed

In my previous code challenge, I asked you to write a function that tells you which of its lines has been removed. The instructions were: Write a function that contains five lines. If you run ...
7
votes
5answers
1k views

“Useful” self-modifying script for financial firm [closed]

True Story: Several years ago while interviewing at an investment advisory firm that managed over a billion dollars in client funds, I was asked a collection of reasonable and bizarre questions by a ...
3
votes
7answers
746 views

Creating a quine in as many characters as possible [closed]

A code-bowling is not the same as a code-golf, in a Code-Bowling, you should solve the challenge in as many characters as possible. The goal of this Code-Bowling is to create a quine in as many ...
12
votes
5answers
749 views

Hardy–Ramanujan number generalization

1729, known as the Hardy–Ramanujan number, is the smallest positive integer that can be expressed as the sum of two cubes of positive integers in two ways (...
22
votes
4answers
2k views

Minify Brainfuck

Your challenge is to minify Brainfuck code, according to these rules: Remove anything that is not one of +-><[].,. For any group of consecutive ...
0
votes
2answers
140 views

Party all week end for my birthday? [duplicate]

Knowing a given date (11/28/1973), and supposing I will die when I'm 99, what are the years when my birthday will be a thursday so that I will be able to party all ...
65
votes
15answers
17k views

9 Hole Challenge [closed]

The 9 Hole Challenge 9 code golfing challenges of varying difficulty. Penalties for using the same language more than once. The question will be updated with pars, hole champions and trophy winners....
7
votes
3answers
476 views

Convert integer to balanced dozenal

Create a function which takes an integer and returns an array of integers representing the number in balanced base twelve. Specifically, the representation should follow these rules regarding 6 & -...
19
votes
6answers
2k views

An unintentional-looking but crash-causing bug [closed]

There are a range of questions revolving around this concept, but these all seem to just involve causing a crash, resulting in many answers which are very obviously designed to cause a crash. So the ...
10
votes
7answers
4k views

How do I convert a word document to a pdf?

Help guys my assignment says it needs to be in .pdf format but I did it in Word. I'm really stuck. How do I take a word document in .docx format and make a .pdf that contains all the text from it? ...
9
votes
10answers
2k views

how to find n'th number in the decimal expansion of a proper fraction? [duplicate]

Given three integers N,D,R write a program to output Rth digit after the decimal point in the decimal expansion for a given proper fraction N/D.
18
votes
61answers
10k views

How do I find the factorial of a positive number?

The challenge: Write a program or a function that inputs a positive number and returns its factorial. Note: This is a code-trolling question. Please do not take the question and/or answers ...
48
votes
35answers
46k views

Print a smiley face

Requirements For the sake of the challenge let's define a unit: A unit is defined as any point that compose the grid in which the face is drawn (pixels for screen, characters for ASCII art, etc..)....
39
votes
86answers
9k views

Challenge: Write a piece of code that quits itself [closed]

I'm searching (am I?) for a piece of code that quits immediately - in an absolutely unconventional way. This does not mean: System.exit((int) 'A'); (Java). It ...
13
votes
24answers
2k views

Swap contents of two files

This is a code-golf question. You need to take the contents of two separate files (i.txt and o.txt) and swap them. You can create a third file to help you with the process, but have your program ...
21
votes
44answers
15k views

How do I split a string??? Help plz? (code trolling) [closed]

My homework assignment is take a string and split it into pieces at every new line. I have no idea what to do! Please help! Note: This is a code-trolling question. Please do not take the question and/...
13
votes
3answers
2k views

Implement the Universal Machine emulator

The goal is to write a full program that emulates the Universal Machine from ICFP 2006 with the shortest code. The Universal Machine has a very simple instruction set explained here. The emulator has ...
42
votes
75answers
13k views

How do I write an adding function? [closed]

The problem: I am the lead developer for a big company, we are making Skynet. I have been assigned to Write a function that inputs and returns their sum RULES: No answers like ...
13
votes
22answers
3k views

Input text from one file, output it to another

The challenge: Input text from one file and output it to another. Solution should be a complete, working function. Note: This is a code-trolling question. Please do not take the question and/or ...
28
votes
13answers
2k views

Write a function that tells you which of its lines has been removed

Write a function that contains five lines. If you run the function as-is, it should return 0. If you remove any one of the five lines and run the function, it should tell you which of the lines has ...
16
votes
36answers
10k views

Generate a random sequence of numbers

The challenge: Generate a random sequence of numbers. The only input should be the length of the sequence. Extra internet points for pure-functional solutions. Note: This is a code-trolling question....
33
votes
30answers
34k views

How do I find the longest palindrome in a string?

The challenge: Make a function that finds the longest palindrome inside a string. Note: This is a code-trolling question. Please do not take the question and/or answers seriously. More information ...
11
votes
8answers
1k views

Convert arbitrary roman numeral input to integer output [duplicate]

The usual rules: no external resources, or the like. Input will be a positive integer in valid Roman numeral format less than 10 thousand, say. Use all the Roman numeral characters: I = 1 V = 5 X ...
280
votes
141answers
487k views

I need a program where the user inputs an array of doubles and the program outputs the array sorted

Note: This question was severely edited since I first posted it here. The rules were moved to here, read them before posting any answer to understand the purpose of this. This was the first question ...
6
votes
6answers
849 views

Cardinal Numbers in Standard American English

Let n be any integer between 1 and 999,999 inclusive. Your challenge is to write a complete program which using stdin or command-line arguments takes in n and outputs the number of times the letter "o"...

15 30 50 per page
1
206 207
208
209 210
233