All Questions

5
votes
4answers
92 views

Calculating total slots

Given a list of jobs, which must be done in order, with each taking a slot to do, how long will it take to perform them all if after doing a job the same job cannot be done for the next two slots (...
45
votes
21answers
4k views

Make a Bowl of Alphabet Soup

This is what we'll call a bowl of alphabet soup - a roughly circular ascii-art shape with the 26 uppercase English letters (A-Z) arranged clockwise to form the perimeter: ...
15
votes
2answers
172 views

Japanese Multiplication [duplicate]

There's a visual method for multiplication that is taught to Japanese schoolchildren [citation needed] that uses lines and crossings to get the answer. Image Source Your task is to implement this in ...
31
votes
34answers
1k views

Multiplicative persistence

Multiplicative Persistence Multiply all the digits in a number Repeat until you have a single digit left As explained by Numberphile: Numberphile "What's special about 277777788888899?" Numberphile ...
0
votes
0answers
39 views

Nearest hamming cycle period in MD5

This riddle was inspired by that thread. Consider that you are super-hacker and try to break MD5 hashing algorithm by looking for a hash collisions for a given hash string which your friend gave to ...
141
votes
249answers
35k views

1, 2, Fizz, 4, Buzz

Introduction In our recent effort to collect catalogues of shortest solutions for standard programming exercises, here is PPCG's first ever vanilla FizzBuzz challenge. If you wish to see other ...
73
votes
79answers
10k views

Count of “a”s and “b”s must be equal. Did you get it computer?

In the popular (and essential) computer science book, An Introduction to Formal Languages and Automata by Peter Linz, the following formal language is frequently stated: mainly because this language ...
39
votes
66answers
4k views

StringgnirtSStringgnirtSStringgnirtS

Here is a relatively simple challenge for you. Given a string of length N, output the string forwards, then backwards, then forwards, then backwards... etc. N times. For example, if your input was <...
20
votes
44answers
2k views

Count repetitions of an array

You will receive an array and must return the number of integers that occur more than once. [234, 2, 12, 234, 5, 10, 1000, 2, 99, 234] This will return 2, since ...
24
votes
22answers
3k views

Code Golf: 6174 - Kaprekar's mythical constant

Why is the number 6174 so interesting? As defined by Wikipedia Take any four-digit number, using at least two different digits. (Leading zeros are allowed.) Arrange the digits in ascending ...
-4
votes
0answers
28 views

Masm 615 Assembly language question [on hold]

need help with an assembly program which does the following: using Masm 615 assemble languahe define an array of 32-bit integers (i.e. DWORDS) .data sarray DWORD 500h, 400h, 300h, 200h, ...
96
votes
91answers
10k views

Make an error quine!

Your challenge: write a "program", for a language of your choice, that causes the compiler/interpreter/runtime to produce error output when compiling/running your program which is identical to your ...
70
votes
136answers
15k views

“99 Bottles of Beer”

Write a program that outputs the lyrics to 99 Bottles of Beer, in as few bytes as possible. Lyrics: ...
27
votes
10answers
823 views

Visual Long Multiplication

There is a nice way to perform long multiplication for two integers without having to do anything but counting, which occasional gets shared around the internet. You write the digits of each number as ...
64
votes
56answers
14k views

Sing Baby Shark

"Baby Shark" is a children's song about a family of sharks. Having long been popular as a campfire song, it has been popularized since the mid-2000s by social media, online video and radio. - ...
13
votes
9answers
2k views

Draw the Hilbert Curve

A Hilbert Curve is a type of space-filling curve, and it basically maps a line to a plane. Each point in the line corresponds to just one point in the plane, and each point in the plane corresponds to ...
209
votes
108answers
30k views

Without using numbers, get the highest salary you can. But don't exaggerate!

As I'm applying for some jobs whose job advert doesn't state the salary, I imagined a particularly evil interviewer that would give the candidate the possibility to decide their own salary ...by "...
393
votes
736answers
116k views

“Hello, World!”

So... uh... this is a bit embarrassing. But we don't have a plain "Hello, World!" challenge yet (despite having 35 variants tagged with hello-world, and counting). While this is not the most ...
24
votes
19answers
1k views

The Digit Triangles

Challenge: Input: A positive integer \$n\$ Output: Create a list in the range \$[1,n]\$, and join it together to a string (i.e. \$n=13\$ would be the string ...
11
votes
9answers
434 views

New Order #1: How does this feel?

Introduction Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. ...
15
votes
11answers
677 views

New Order #2: Turn My Way

Introduction (may be ignored) Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all ...
77
votes
101answers
15k views

Shortest code to produce non-deterministic output

You need to produce output that is non-deterministic. In this case, this will be defined to mean that the output will not always be the same result. Rules: A pseudo-random number generator that ...
45
votes
40answers
4k views

Tips for golfing in PowerShell

What general tips do you have for golfing in Windows PowerShell? I'm looking for ideas that can be applied to code golf problems in general that are at least somewhat specific to PowerShell (e.g. "...
32
votes
51answers
2k views

Reverse a string by chunks

Your task is to write a program which, given a number and a string, splits the string into chunks of that size and reverses them. Rules Your program will receive a positive integer ...
23
votes
23answers
1k views

The Base in the mix

Input: A list/array of integers for which each item is in the range of 2-36. Output: The sum of the integers (as base 10), where each next integer is in the base ...
15
votes
35answers
2k views

Chessboard pattern

Input: a positive number, smaller then 80, from stdin or as a command-line argument. Output: A square chessboard pattern, the size of the input number. The dark fields are represented by the letter '...
45
votes
58answers
3k views

Print the f × f times table

Your task is to print the hexidecimal times table: ...
26
votes
25answers
4k views

Generate a password

It is very hard to remember my password, so I came up with a way to generate a password. The way I generate my password is from a word or a sentence, following these steps: Start from left to right ...
13
votes
11answers
1k views

Terms of the EKG sequence

Introduction The EKG sequence begins with 1 and 2, then the rule is that the next term is the smallest positive integer not already in the sequence and whose common factor with the last term is ...
27
votes
13answers
5k views

Tips for golfing in 05AB1E

Do you have any tips for code-golfing in 05AB1E, a golfing language created by Adnan? Your tips should be at least somewhat specific to 05AB1E. Please post one tip per answer.
22
votes
15answers
1k views

Output visual diagram of picture

Write a program that inputs the dimensions of a painting, the matting width, and the frame width for a framed portrait. The program should output a diagram using the symbol ...
30
votes
19answers
2k views

Convert number to a base where its representation has most “4”s

Inspired by this. There is a number, given as either integer, string or array of digits (your choice). Find the base in which the representation of the number will have most "4"s and return that base. ...
83
votes
31answers
15k views

Eww, those bytes are gross

Write a program or function that, when given a string, filters out as many distinct bytes as it can and returns the cleaned string. However, since your program hates them, none of these bytes can be ...
81
votes
63answers
21k views

It took me a lot of time to make this, pls like. (YouTube Comments #1)

Hold up..... this isn't trolling. Background These days on YouTube, comment sections are littered with such patterns: ...
76
votes
233answers
14k views

Create output twice the length of the code

The Challenge Write a complete program that writes twice as many bytes to standard output as the length of the program. Rules The program must write ASCII characters to the standard output. The ...
6
votes
5answers
434 views

Gotta Collect 'Em All

Your task here will be to write a very dumb AI capable of fetching all treasures on a map. Map The map is defined as follow: (artist-mode™-powered) Basic case: <...
15
votes
21answers
3k views

Deal the cards to the players

Tonight is card game night! You are the dealer and your task is to write a program to deal the cards to the players. Given an array of cards and the number of players, you need to split the array of ...
30
votes
5answers
2k views

8bit virtual machine

Background I like my old 8-bit 6502 chip. It's even fun to solve some of the challenges here on PPCG in 6502 machine code. But some things that should be simple (like, read in data or output to ...
-4
votes
0answers
99 views

What color is your web page? EDITTED [on hold]

A business owner wants to create a website home page, whose background color dynamically and linearly changes with the time of the day based upon the following: Midnight: Black Between Midnight and ...
4
votes
3answers
226 views

Convert ASCII art numbers to integers

Inspired by this game Challenge: Given an ASCII art string representing a number, output that number. Example: ...
53
votes
53answers
4k views

I'm too cold, turn up the temperature

This is my first golf contest. What you need to do Build me, in the shortest amount of bytes possible, my AC remote control system. My room is too cold right now, and I'm missing my remote. Now, I ...
89
votes
32answers
6k views

Would this string work as string?

Write a program that takes a single line string that you can assume will only contain the characters /\_‾. (That's forward and backward slash, underline and ...
62
votes
47answers
6k views

N-dimensional N^N array filled with N

In: Enough memory and a positive integer N Out: N-dimensional N^N array filled with N, where N^N means N terms of N-by-N-by-N-by... Examples: 1: [1] ...
24
votes
11answers
2k views

Is this Pascal's Matrix?

In Pascal's triangle each number is the sum of the two numbers directly above it, treating empty spots as zero: By rotating the triangle, we can cut out square matrices of varying sizes and rotations ...
42
votes
63answers
4k views

Is it a pangram?

Write a function or program that takes as its input a string and prints a truthy value if the string is a pangram (a sequence of letters containing at least one of each letter in the English alphabet) ...
14
votes
48answers
4k views

Print the amount of ones in a binary number without using bitwise operators

Description Given a number, print the amount of 1s it has in binary representation. Input A number >= 0 in base 10 that ...
7
votes
14answers
449 views

Offset in split text content

You will be given an ASCII text. This text may have zero, one or many appearances of a split a character (let's assume it will be the space character ) You will ...
21
votes
21answers
5k views

It's a yearly task, alright

Given a number 1≤n≤365, output the nth day of the year in "Day-numberth Month" format. For example, given 1, you should output "1st January", without "of". The Gregorian calendar will be used and the ...
114
votes
52answers
25k views

GO OUT AND VOTE

Today is November 8th, 2016, Election Day in the United States of America. If you are a U.S. citizen eligible to vote, then go out and vote if you haven't already before answering this challenge. Do ...
40
votes
24answers
3k views

Center The Text!

Center The Text! In this challenge you will be centering various lines. Examples Foo barbaz Foo barbaz ...

15 30 50 per page