3
votes
0answers
49 views

Efficient Scientific Notation

The other day my chemistry teacher was explaining to us about scientific notation (using a small number and multiplying it by powers of ten to express large numbers more easily), which brought me back ...
0
votes
0answers
33 views

Print a message if the programmer forgets to use an `else` [on hold]

Write some code, that when executed changes your language by forcing all subsequent if statements to have an accompanying bare else statement (i.e. not just else ifs), otherwise if no conditions are ...
4
votes
1answer
86 views

Implement almost-equals for IEEE numbers

Isn't it annoying when you're working with floating point numbers and your code doesn't work because two numbers are not equal by the least significant bit? Now you can fix that! Write some code that ...
14
votes
12answers
198 views

Find the nth cross-alternate sum

Given an input of a single positive integer, output the "cross-alternate sum" that corresponds to that integer. Take the example of the input n=5. To find the cross-alternate sum, first create a ...
11
votes
5answers
196 views

Find the coastline

Your task is to find the length of the coastline of a map of islands provided in an ASCII map. The input map will consist of 1 or more # characters that indicate land, and spaces which indicate water. ...
8
votes
0answers
79 views

Fibonacci's numbers … not those!

Leonardo da Pisano a.k.a Fibonacci was instrumental in bringing the Hindu-Arabic numeral system into Europe. Before that, mathematicians there worked in base sixty with Roman numerals. For example, ...
13
votes
4answers
194 views

Convert the Time to a String

Problem One day, you boss walks up to you and tells you he needs to know the time. He still insists after you pointing at the clock directly above you head, and confesses he has a severe case of ...
18
votes
27answers
1k views

Find the largest and the smallest number in an array

The Task The task is very simple. Given an array containing only integers and strings, output the largest number and the smallest number. Test Cases Input: [1, 2, 3, 4, 5, 6, 7, 8] Output: 1, 8 ...
12
votes
4answers
290 views

All the numbers that fit in a string

Write a program or function that takes in a positive integer N. Output a list of all the distinct decimal numbers that can be written in exactly N characters using digits (0123456789), decimal points ...
17
votes
3answers
175 views

Magnetic pull in an array

Background I have a row of powerful magnets and a bunch of metal objects between them. Where will the magnets pull them? Input Your input is an array of non-negative integers, which will contain at ...
23
votes
13answers
1k views

Fibonacci-style matrix expansion

For each row and then column of a matrix, we can add an extra entry with the sum of the last two entries in that row or column. For example with the following input matrix: [ 1 1 1 ] [ 2 3 4 ] The ...
1
vote
0answers
150 views

Shortest code to cycle through RGB LEDs [on hold]

Given four RGB LEDs and 8 colors, your task is to light up each LED in order with a color, and cycle through the LEDs as you cycle through the colors; with only one LED lit up at a time. So for 8 ...
-7
votes
0answers
60 views

How do you create a program like this [on hold]

Write a program that allows the use to enter 25 numbers in any order and then display the numbers in a 5 x 5 matrix. When the row is printed the sum of each number in the row should then be printed to ...
15
votes
1answer
253 views

The PPCG Handicap System

As we all know, meta is overflowing with complaints about scoring code-golf between languages (yes, each word is a seperate link, and these may be just the tip of the iceberg). With so much jealousy ...
16
votes
23answers
2k views

Build a chessboard

Saw this in a PHP challenge. The objective is to make a chessboard with 64 squares (8*8) with the minimum amount of code. Simple enough, I made mine in PHP in 356 bytes (not impressive, I know) and I ...
-4
votes
0answers
33 views

find user define prime no [on hold]

//We have to find those elemets whos is self dividual in user's given string import java.util.*; class Newprime { public static void main(String str[]) { int Prime[]=new int[5]; int ...
15
votes
3answers
288 views

What language is this word?

Your should write a program or function that determines the language of a given word. The task is to recognize some of the 5000 most common words in 4 languages: English German Italian Hungarian ...
-3
votes
0answers
98 views

Determine whether simple equations are solvable or not [on hold]

Based on the rather extensive comments, here is a clarification: This is only the first stage of a multi-stage process to determine whether simple equations are solvable or not (and if they are, ...
20
votes
33answers
2k views

Electrical outlet

This is a problem from NCPC 2005. Roy has an apartment with only one single electrical outlet, but he has a bunch of power strips. Compute the maximum number of outlets he can have using the power ...
7
votes
2answers
134 views

Display powers of Phi with Fibonacci precision

Write some code that takes a single non-negative integer n and outputs the nth power of Phi (ϕ, the Golden Ratio, approximately 1.61803398874989) with the same number of decimal digits as the nth ...
-1
votes
0answers
27 views

PigLatin translator [duplicate]

What you need to do: The player can enter amy words in english, and your program needs to output the piglatin version of it Piglatin: If a word starts wirth a consonent sound, then the letters ...
3
votes
1answer
45 views

Tips for golfing in vim

I've recently realized how vim works great for golfing, especially for kolmogorov-complexity. Also, according to meta vim is a perfectly acceptable 'programming language' at least, for the scope of ...
11
votes
4answers
241 views

Interpret the Pig series

Given an input of a Pig, SickPig, DeadPig, QuinePig, or DeafPig program, choose one of those "languages" randomly and interpret the input as that "language." First, randomly choose between one of the ...
17
votes
7answers
257 views

Print the Super Collatz numbers

The Collatz Sequence (also called the 3x + 1 problem) is where you start with any positive integer, for this example we will use 10, and apply this set of steps to it: if n is even: Divide it by ...
-1
votes
0answers
91 views

The density of the rain [on hold]

Introduction When you look out of the window and it´s raining you will see a slight blur on distant objects. If it´s raining heavy or the raindrops are smaller, you will see less, which may finally ...
19
votes
16answers
856 views

Rearranging the sequence

Introduction Let's observe the following sequence (non-negative integers): 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, ... For example, let's take the first three numbers. These are 0, 1, 2. ...
12
votes
1answer
147 views

Enumerate rhyme schemes

A "rhyme scheme" is a string of letters a to z, such that the first occurrences of the characters are in ascending order (without gaps), starting from a. For example (with first occurrences marked): ...
28
votes
5answers
317 views

Cycling with Rubik's

While idly twisting my Rubik's cube around, my son noticed that it kept going back to the solved state. I'm pretty sure he thought this was some sort of voodoo magic at first, but I explained that if ...
14
votes
3answers
297 views

Check work periods

Introduction Here in Germany the ruling on work times is very strict. If you work 6 or more hours a day, you have to take at least a 30 minute break. If you work 9 or more hours, you need to take a ...
20
votes
5answers
862 views

Tips for golfing in Jelly

Jelly is a tacit, golf-oriented programming language by our very own Dennis. It’s popping up in answers here more and more often, beating other golf-y languages like Pyth and CJam, both by using its ...
11
votes
31answers
3k views

Go generate some Java

Your boss wants you to write code like this: public static boolean isPowerOfTen(long input) { return input == 1L || input == 10L || input == 100L || input == 1000L || input == 10000L ...
7
votes
1answer
158 views

Choose Scenes for a Movie

Introduction Finally the movie company is financing your film. They have given you a maximum budget and they also set the running time of your movie. Now you can start with the pre-production. You ...
2
votes
0answers
57 views

Tips for golfing in Subleq

Subleq is a programming language with only one instruction. Each instruction contains 3 parameters. Code and data space is the same. How it works: A B C A, B and C are signed ints. Instructions are ...
20
votes
40answers
3k views

Generate 100 Java Tuple classes

Write a script that writes to standard output, or your language's equivalent, 100 lines of (valid) Java code that beginning with: class Tuple1 {public Object _0;} class Tuple2 {public Object _0,_1;} ...
26
votes
18answers
2k views

This Challenge Makes Cents

I know, the title cracks you up Given an amount of money output the fewest number of coins make up that amount Examples 0.1 1 dime 0.01 1 penny 0.28 1 quarter 3 penny 0.56 2 quarter 1 nickel 1 ...
8
votes
4answers
158 views

Do you need a cup holder?

You're going to replicate the 90's cup holder joke software. Here's what's it did, and you have to do: Display the message Do you need a cup holder? If the user confirms, enter an infinite loop ...
1
vote
0answers
61 views

Code Golf Pro Golfer Least Swings Calculator

Your Challenge: For a golf Course Of Inputted 'n' length to hole where: 'n' is a whole number and a multiple of 5 between 150 and 500 and 1 integer in code = 1 metre You must calculate the least ...
15
votes
13answers
375 views

Say What You See

The "Look and say" or "Say what you see" sequence is a series of numbers where each describes the last. 1 11 (one one) 21 (two ones) 1211 (one two one one) 111221 (one one one two two ones) 312211 ...
7
votes
2answers
97 views

The confused twister

The basic idea is to write a program that twists itself, and the twisted version untwists itself. The first program will just be the twisting algorithm described here, and when given its own source ...
0
votes
0answers
65 views

Mutating checksum [on hold]

Create an user specified number (long long) of text files in the current working directory, labelled as 1.txt, 2.txt... With the same numbers as their names occupying the first line. The second line ...
16
votes
8answers
566 views

Spiral Permutation Sequence

We can roll up the natural numbers in a rectangular spiral: 17--16--15--14--13 | | 18 5---4---3 12 | | | | 19 6 1---2 11 | | | 20 7---8---9--10 ...
26
votes
7answers
6k views

Build a twisted “Hello world!”

Your job is quite simple, write a program that prints Hello, world!, that when twisted creates a program that prints Twister!. How strings are twisted The twisting algorithm is very simple. Each ...
22
votes
37answers
2k views

Consolidate an Array

The task is simple: consolidate an array of ints. Consolidating this array consists of the following: All instances of 0 need to be moved to the end of the array. There should be no 0s between the ...
6
votes
3answers
180 views

It's snowing in my consoles window!

You love watching the snow falling outside, but you know it won't be snowing much longer. You could take a video, but decide to make a snow animation because ... um ... you need to practice your ...
15
votes
12answers
543 views

Remove specified non-numeric rows

In case there's any doubt: Nan = Non-numeric datatype for the purposes of this challenge. Write a program or function that takes a matrix / array as input, as well as a list of column indices. ...
16
votes
3answers
444 views

Label dead ends

Given an input of an ASCII art "road," output the road with all dead ends labelled. This is a road: ########.....######..#..### #......#######....#..#..#.# #.##......#...#####..#..### ...
11
votes
8answers
921 views

Indexable quine

The goal of this challenge is to make a program that outputs the nth letter of its source code where n is given as input to the program. Like most quine challenges, you are not allowed to read your ...
20
votes
14answers
2k views

Golf a string twister

How strings are twisted The twisting algorithm is very simple. Each column is shifted down by its index (col 0 moves down 0, col 1 moves 1, ...). The column shift wraps to the top. It works like ...
-4
votes
0answers
75 views

Polyglot Golfing Challenge [on hold]

Write a polyglot (a program that works on several languages) that produces the // this is a comment output. Example (JS + Plain PHP + Plain HTML) (74 / 3 = 24.66 points) // this is a comment<?php ...
-6
votes
0answers
114 views

Broken calculator reprogramming service

You work at a calculator reprogramming service. Business is usually rather mediocre, but you've got yourself a challenge this time. This calculator is almost completely broken. The only parts of it ...

15 30 50 per page