Linked Questions

121 votes
409 answers
30k views

Print a 10 by 10 grid of asterisks

Background This is a standard textbook example to demonstrate for loops. This is one of the first programs I learnt when I started learning programming ~10 years ago. Task You are to print this exact ...
Leaky Nun's user avatar
  • 49.7k
100 votes
92 answers
17k views

It was just a bug

Inspired by the bugged output in @Carcigenicate's Clojure answer for the Print this diamond challenge. Print this exact text: ...
Kevin Cruijssen's user avatar
102 votes
44 answers
13k views

Tips for golfing in <all languages>

The aim of this post is to gather all the golfing tips that can be easily applied to <all languages> rather than a specific one. Only post answers that its ...
ajax333221's user avatar
  • 3,644
69 votes
87 answers
12k views

What do you get when you multiply 6 by 9? (42)

I love math. But I can't find a single calculator that can multiply correctly. They seem to get everything right except 6*9 (It's the question to life, the universe, and everything! How could they get ...
Tezra's user avatar
  • 1,547
78 votes
66 answers
19k 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. - ...
njha's user avatar
  • 997
52 votes
83 answers
5k views

Bernardino identifies unaltered dollar words

Definition A dollar word is a word where when each of its letters is given a cent value, from a = 1 to z = 26, and the letters are summed, the result is 100. Here is an example on CodeReview, and here ...
Stephen's user avatar
  • 13.8k
37 votes
73 answers
9k views

Randomizing until 0

Challenge Sandbox post Given a positive integer (K) Output a uniformly-random integer (Y) between ...
Luis felipe De jesus Munoz's user avatar
81 votes
30 answers
12k views

Create an "H" from smaller "H"s

Challenge Create a function or program that, when given an integer size, does the following: If size is equal to 1, output ...
Bazinga_9000's user avatar
25 votes
82 answers
7k views

Invert a boolean array

A nice simple one Input Given a boolean array (Or an acceptable alternative), you can assume the array will never be more than 32 elements long. ...
Shaun Wild's user avatar
  • 2,491
50 votes
50 answers
5k views

Split string on first occurrence of each character

Related. Given a printable ASCII string, split it into a list of non-empty strings with a new sub-string beginning every time a character, which has not previously been seen in the same case, occurs. ...
Adám's user avatar
  • 30.2k
35 votes
60 answers
5k views

Write a Deadfish Interpreter

Sandbox, Codidact A rewrite of this question with a simpler input format and guidelines. Challenge Deadfish uses a single accumulator, on which all commands are to be performed. It has the following ...
Razetime's user avatar
  • 27.1k
17 votes
97 answers
5k views

Output the language name times the number of characters [closed]

Challenge: Your task is to use any language to output that language's name times the number of character's in its name. Use the common name or acronym of the language. If there are multiple versions ...
NK1406's user avatar
  • 739
43 votes
44 answers
5k views

Write a haiku-w detector

A haiku is a poem with three lines, with a 5/7/5 syllable count, respectively. A haiku-w is poem with three lines, with a 5/7/5 word count, respectively. Challenge Write a program that will return ...
DomTheDeveloper's user avatar
29 votes
55 answers
4k views

The world ends in ed

Taken straight from the ACM Winter Programming Contest 2013. You are a person who likes to take things literally. Therefore, for you, the end of The World is ed; the last letters of "The" and "World" ...
beary605's user avatar
  • 4,350
22 votes
53 answers
3k views

Create an ASCII line, given a length

Information Create a diagonal line given its length (let’s call the variable, say, \$n\$ where \$n > 0\$) The diagonal line starts from the top left and goes to the bottom right. You must use the ...
zoomlogo's user avatar
  • 1,655
26 votes
44 answers
3k views

X Steps Forward, 1 Step Back

Here the first 100 numbers of an easy sequence: ...
Kevin Cruijssen's user avatar
22 votes
45 answers
2k views

Shifted auto-sum

Let’s take a positive integer such as 123. We define the shifted auto-sum of this integer as follows: 123 has 3 digits. We thus consider 3 copies of 123. We stack ...
Fatalize's user avatar
  • 38.7k
31 votes
30 answers
6k views

Is it a Bumpy Word?

(inspired by this challenge over on Puzzling -- SPOILERS for that puzzle are below, so stop reading here if you want to solve that puzzle on your own!) If a letter in a word occurs alphabetically ...
AdmBorkBork's user avatar
  • 43.4k
29 votes
30 answers
3k views

Bytes/Character

Task Given a UTF-8 string (by any means) answer (by any means) an equivalent list where every element is the number of bytes used to encode the corresponding input character. Examples ...
Adám's user avatar
  • 30.2k
30 votes
28 answers
8k views

Output all the white or black squares of a chessboard

Introduction This is how a chessboard looks like. You can see that a1 is a dark square. However, b1 is a light square. The Task ...
Adnan's user avatar
  • 44.4k
39 votes
24 answers
3k views

Print the nth prime that contains n

This question will be a twist on finding the nth prime number. Challenge You must write a program that will take one input n, ...
ericw31415's user avatar
  • 2,302
25 votes
31 answers
2k views

Enumerate an array, grouping duplicates

The objective of this challenge is to take an array of positive integers, and enumerate its indices, grouping like elements. An enumeration without any duplicates is done by just outputting an array ...
Pavel's user avatar
  • 9,377
39 votes
18 answers
4k views

Judge a book by its cover

Overview The cover of a book will be provided in the following ASCII format: ______ | | | | | | | | ------ The input can be in any reasonable format ...
math junkie's user avatar
  • 7,227
22 votes
31 answers
5k views

Sum the First n Even Fibonacci Numbers

There seems not to be a contest for this one yet. The task is simple. Add the first n numbers of the Fibonacci sequence that are even and output the result. This ...
dfernan's user avatar
  • 550
25 votes
25 answers
4k views

Fill a bowl with alphabet soup

We seem to never get tired of alphabet-related challenges... The recipe Given a string of letters S, and two positive integers ...
Luis Mendo's user avatar
  • 104k
20 votes
31 answers
2k views

Which weekday was it?

This challenge, I hope, is simple to understand. Given a date-string (given in any format you prefer, so long as it has 4 digits of year and 2 digits of day and month), calculate the weekday for the ...
SectorCorruptor's user avatar
22 votes
21 answers
3k views

Gödel numbering of a string

Background Gödel numbers are a way of encoding any string with a unique positive integer, using prime factorisations: First, each symbol in the alphabet is assigned a predetermined integer code. Then, ...
pxeger's user avatar
  • 23.7k
18 votes
25 answers
2k views

Factory workers

Challenge Factory workers are usually very hard-working. However, their work is now being commonly replaced with machines. You have to write a program that takes a number as input. It will print out ...
lolad's user avatar
  • 842
11 votes
39 answers
4k views

Alphabet Position Finder

Inspired by the Codewars Kata. Your goal is to take an input string such as this one: "'Twas a dark and stormy night..." and return a string containing the ...
Theo C's user avatar
  • 135
8 votes
33 answers
2k views

Custom Rows of Smileys Triangle

This problem is inspired from shinh's problem. Given an input of positive integer \$n\$, output a smiley triangle (see below) with \$n\$ rows. Detailed rules Can be either a function or a full ...
user avatar

15 30 50 per page