1
vote
0answers
21 views

Sourcecode selfie

Objective: A guru once said a perfect code selfie is best shot diagonally from upper left corner. A code selfie is almost like a Quine - but rotated 45 degree clockwise. Your mission is to code a ...
6
votes
0answers
41 views

Let's build a race car track!

Introduction My niece wants to make a race car track. She has wooden parts that fit together to form the track. Each part is square shaped and contains a different shape. I'll use the pipe drawing ...
1
vote
1answer
69 views

Minimum of a Polynomial in Python

What is the shortest amount of code that can find the minimum of an inputted polynomial? I realize that you can import packages like Numpy and others, but using only user defined functions, what is ...
10
votes
2answers
141 views

Compute the Resistance of a 4 Band Color Coded Resistor

Resistors commonly have color coded bands that are used to identify their resistance in Ohms. In this challenge we'll only consider the normal 4-band, tan, axial-lead resistors. We'll express them as: ...
8
votes
5answers
295 views

Split as number, join as string, repeat

Consider the process of: Taking a non-negative integer N. e.g. 27. Spliting it into integers N - floor(N/2) and floor(N/2) (a 'bigger' and 'smaller' half) and writing them in that order. e.g.27 ...
4
votes
0answers
85 views

Stone Maze Chess solver

Background: Every war eventually comes to an end, but the end is never absolute. The Stone Maze Chess scenario takes place after a game of chess is finished. The enemy King is dead and the pieces is ...
16
votes
6answers
475 views

Multiplication by Self-Modification

...at least for some definition of "self-modification". The Task In this challenge, your task is to write three strings A, B and C that satisfy the following properties. The string B has length at ...
20
votes
9answers
626 views

Temperature Converter

This is a byte sized challenge where you have to convert an input temperature in one of the three units (Celsius, Kelvin and Fahrenheit) to the other two. Input You would be provided with a ...
6
votes
3answers
195 views

Number of ways to sum [1..n] with [n+1..2n] such that each sum is prime

Let n > 0. Let X = [1..n] and Y = [n+1 .. 2n]. Define a(n) as the number of permutations p of Y such that every element of X + p(Y) is prime. For example: n = 2 X = [1,2] Y = [3,4] p0(Y) = [3,4] ...
11
votes
5answers
918 views

What is the Probability that a Knight Stays on Chessboard?

Given the size of the chess board and initial position of the knight, calculate the probability that after k moves the knight will be inside the chess board. Note: The knight makes its all 8 ...
25
votes
6answers
1k views

Clarence the Slow Typist

Introduction Clarence is a data entry clerk who works at an internet service provider. His job is to manually enter the IP addresses of all of the ISP's customers into the database. He does this ...
6
votes
3answers
169 views

Write a self replicating program that stops replicating after “printing” “Hello world!” with the filenames

Write a self replicating program, in the source code filename H.*, contianed in an empty folder then manually compile and run or just run the program if your chosen language is dynamic, and it should ...
5
votes
9answers
505 views

Take first letter of each word, leave spaces and punctuation

Shrink each word in a string of group of strings to single letters delineated by spaces or punctuation. Example I'm a little teapot, short and stout. Here is my handle, here is my spout. When I get ...
-1
votes
0answers
49 views

Check if number N is within possible combinations of a sorted array of numbers [duplicate]

For sorted array of integers X = [x1, x2, x3, ....] where x1 < x2 < x3, ... And integer Y Check if Y has a possible 1 or more integers in the array X that add up to equal the value of Y Test ...
0
votes
0answers
55 views

The polyglot challenge! [duplicate]

A polyglot is a program which can be run by several different language's interpreters/compilers without failing. For example, the stackoverflow 404 page contains a polyglot which runs in Python, ...
0
votes
0answers
31 views

Number of right cyclic shifts to give the biggest number [on hold]

I am preparing to coding interview and I met this task today: You are given 30-bit unsigned integer N. A right cyclic shift of N by K bits is the result of performing a right cyclic shift of N by one ...
10
votes
5answers
718 views

It's election time!

It's time... to count the votes! Today there are local elections in my entire country. Here, the number of seats for each party is decided using the D'Hondt method. Your goal is to implement a ...
23
votes
3answers
466 views

Block Building Bot Flocks!

Intro This is an interactive king-of-the-hill contest where the controller is fully contained in a Stack Snippet at the bottom of the question. The controller automatically reads the answers and ...
16
votes
2answers
287 views

Finding the Deadlock

Finding the Deadlock When programming a multithreading application one must take good care to avoid deadlocking the various threads when accessing shared resources. A deadlock occurs when a thread ...
2
votes
1answer
75 views

Gode-Colf: Wipping Flords around [duplicate]

Here is another short string related code-golf. You must write a full program that reads a string (from STDIN or as command line arguments, as long as you specify which) and wips the flords around ...
0
votes
0answers
57 views

Shortest program to write to a file and open it with the browser [on hold]

Create program to write to a new file and open it with a web browser. The file must have a text box and perform addition, subtraction, multiplication, parentheses and exponentiation. Must follow order ...
6
votes
2answers
154 views

Tips for golfing in K

K is a programming language in the APL family designed by Arthur Whitney. While the official interpreter is closed-source and commercial, a trial version with a workspace limit of 32 bits of ...
14
votes
5answers
464 views

ASCII Art of the Day #3 - Chinese Shrines

In today's episode of AAOD, we are going to construct a Chinese Shrine of varying heights. Consider the following examples for height (N) 1 to 6 N = 1: . | . ]#[ . \_______/ ...
18
votes
9answers
1k views

Sum in each dimension

You are given a multi-dimensional array of integers. Each dimension has a fixed size (so that it would be always rectangular if it is 2D). Your program should calculate the sums in each dimension and ...
-4
votes
5answers
168 views

Return every N-th word of a string

Your goal is to write a program that, given a number N and a string as input, will return a string containing every Nth word of the original string, starting from the first word. Sample ...
11
votes
1answer
170 views

Find the Fenceposts

Background An atomic bomb has exploded near the fencepost factory! Since fenceposts are essential for the survival of our civilization, we must rescue as many as possible. We are sending ...
16
votes
8answers
615 views

Formatting a Lisp-like Syntax

Background (Based on a true, heart-wrenching story) In my time, I've played around with Lisp and similar languages often. I've written with them, ran them, interpreted them, designed them, and made ...
14
votes
4answers
285 views

Scale up a Diamond Tiling

Any regular hexagon can be tiled with diamonds, for instance like so: ______ /_/_/\_\ /_/\_\/\_\ /\_\/_/\/_/\ \/_/\_\/_/\/ \_\/_/\_\/ \_\_\/_/ We'll consider the above a tiling of size 1 ...
8
votes
23answers
1k views

Count the number of vowels in each word of a string

This is a rather easy challenge. Challenge Input will contain a string (not null or empty) of maximum length 100. Output the number of vowels in each word of the string, seperated by spaces. Rules ...
22
votes
22answers
2k views

Caesar equivalence

Two strings are "Caesar equivalent" if the distance (counting up) between the corresponding characters are the same. Yes, I made this term up. Here's an example: "Abc" and "Cde" are equivalent ...
12
votes
5answers
340 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 ...
-2
votes
0answers
63 views

How can I improve my code? - A program that displays students details [closed]

Marks not displayed when the user searches for a student how can I improve my code so that the marks will be displayed?- This is a school project. class Classroom{ //declaring the variable ...
-6
votes
0answers
83 views

Let's have another Hello world character competition! [closed]

There are some really clever solutions I've seen before for a tiny program. It's always fun and doesn't take too long. Here's my mediocre solution: ...
28
votes
8answers
3k views

ASCII Art of the Day #2 - Flow Snakes

I came across this really nice snow-flake like ASCII fractal by Michael Naylor [citation needed but not found]. Just like a fractal, it grows exponentially in size with each order/iteration. Below are ...
6
votes
16answers
1k views

Stripping off extra spaces from a string

You are given a string. Output the string with one space per words. Challenge Input will be a string (not null or empty), surrounded with quotes(") sent via the stdin. Remove leading and trailing ...
31
votes
11answers
3k views

ASCII Art of the Day #1 - Double Knot

Write a full program or a function that takes a positive integer N as input via STDIN/command line/ARGV or function arguments and prints an ASCII double knot corresponding to the N to STDOUT. The ...
41
votes
22answers
3k views

Check if words are isomorphs

Two words are isomorphs if they have the same pattern of letter repetitions. For example, both ESTATE and DUELED have pattern abcdca ESTATE DUELED abcdca because letters 1 and 6 are the same, ...
6
votes
0answers
164 views

HappyCube Puzzle Solver

This challenge is inspired by a puzzle I played, consisting of foam pieces like these: which have to be assembled into 3D cubes, like these: The puzzle pieces can be viewed as grids of 5 * 5 ...
6
votes
2answers
225 views

Remove the mininum sum seam from an array

The seam carving algorithm, or a more complex version of it, is used for content-aware image resizing in various graphics programs and libraries. Let's golf it! Your input will be a rectangular two ...
0
votes
0answers
112 views

Combine two images into one in an intuitive way [closed]

Objective: The task is to use any two source images of size 800*600 each. Create an algorithm that combines both images - in an intuitive way - into an image of size 1280*750 Rules: You are ...
8
votes
0answers
115 views

Given a table, place in the chairs

Challenge You will be given a table as input, drawn with ASCII | and _. Your task is to set the chairs around it. Example Input: ____ | | | | | | | | |____| Output: _^_^_ < ...
11
votes
12answers
2k views

QuickGolf - Barry the messy developer #2

This is a follow-up of QuickGolf - Ignore the noise #1 the only problem being that Barry has made things even worse for us. Lets see what happened Update I've added code to create random ...
20
votes
3answers
507 views

Selectively murder positive integers

Introduction Arithmetic Gaol is a special facility that incarcerates positive integers. However, recently, the positive integers have been trying to escape. Therefore the wardens have decided to, um, ...
11
votes
0answers
124 views

Schedule a 4-way stop

A bunch of cars are lined up at a 4-way stop sign waiting to proceed. Everyone is confused about who gets to go next, who is going which way, etc. Clearly suboptimal. Your job is to schedule the ...
9
votes
7answers
321 views

Find the longest musical substring

A musical string is any string that can be played on a piano keyboard. For those of us who weren't forced to learn the piano as kids, here is what the keyboard looks like. So the string feed a ...
-1
votes
0answers
14 views

Help with shortening this Haskell combinations snipped [migrated]

I was happy with my shell script that needed to generate alphanumeric combinations of length N (in this case, 3) for i in {a..z}{a..z}{a..z}; do ... Now I became less happy when I needed ...
5
votes
6answers
277 views

Most concise way to fold tree structures

Background (F#) Let there be trees: type Tree<'T> = Node of 'T * Tree<'T> list Now lets fold them nicely with a function called... foldTree f:('a -> 'b -> 'c) -> g:('c -> ...
-2
votes
1answer
67 views

Generate a Pallette for an Image [duplicate]

This is a successor to my previous Code Golf challenge, which may be found here. This time, you are trying to determine what the contents of colors.txt should be. Your task is to take from the input ...
9
votes
2answers
240 views

Finding Poly Nemo!

Oh no! Nemo, our small clown fish is lost in this ASCII ocean and his dad Marlin is trying to find him. Your task is to get Marlin to Nemo safely. But beware, we have a feeding frenzy Bruce on the ...
7
votes
1answer
172 views

Build a poisoned wine testing scheduler

Recently at Puzzling.SE, there was a problem that I wrote about determining which two bottles out of a larger number are poisoned when the poison only activates if both components are drunk. It ended ...

15 30 50 per page