All Questions

Filter by
Sorted by
Tagged with
0
votes
0answers
51 views

Inspired by HQ9+: 4-Behavior Polyglot

Create a program that can be run in 4 different languages such that: One language prints "Hello World!" One language outputs its own source code One language outputs 99 bottles of beer on ...
-6
votes
0answers
27 views

Write a program that reads 2 integers and draws a rectangle of corresponding dimensions [closed]

Write a program that reads 2 integers and draws a rectangle of corresponding dimensions. modify the program such that in all casses the rectangle is always in horizontal position. meaning when the ...
8
votes
5answers
133 views

Print a Ternary Value

Put simply, you are to print out the following number: ...
12
votes
2answers
446 views

Never trust a mastermind

You probably know the game mastermind: The player tries to guess a code of 4 slots, with 8 possible colors - no duplicates this time. Let's call those colors A through H, so possible solutions could ...
6
votes
2answers
429 views

Can I exit the maze with this many bombs?

Inspired by this Puzzling challenge, and easier version of my previous challenge. Challenge A 2D rectangular grid is given, where each cell is either an empty space or a wall. You start at the top ...
5
votes
0answers
111 views

One-card Poker for Two

This is a challenge to write bots to play the 1st and 2nd players in the following simple poker game. Rules of the poker game There are two players, A and B. Each antes $10 into the pot, and is dealt ...
23
votes
23answers
2k views

Source Code Byte Frequency

Source Code Byte Frequency Write a program that get a single byte character as an input and prints the frequency of that byte in the program's source code as an output. Examples: Assuming my program ...
11
votes
19answers
1k views

Mode length of a sentence

The task is simple. You are given a string with alphabetical words (say "Hello world, this are tests"). You have to return the mode of the lengths of ...
12
votes
17answers
2k views

Interviewer's Room

You are James and four of your friends (Bjarne, Eich, Rossum, Ada) are called for an interview. There are n interviewers, and they can each serve one person at a time, alphabetically. Each round of ...
-5
votes
0answers
67 views

maximisation and minimization at the same time [closed]

I have a sorted list in python (sorted by the second element); example: list = [(13,18),(6,12),(5,10),(4,3),(1,2),(0,0)]. I have to pick some elements from this list, such that sum of second numbers ...
8
votes
13answers
632 views

Descending dungeons of positional systems

The sequence discussed in this challenge is a variant of the Descending Dungeons sequence family. Specifically, the sequence generation rules: ...
1
vote
2answers
256 views

Redirect HTTP links to HTTPS with Javascript

What is the shortest way to secure a site with Javascript? I am new to Code Golfing, and this is what I've come up with so far. I bet that this could be improved though: Challenge: Make a script ...
-1
votes
13answers
376 views

Rock Paper Scissors Meta-Gaming Tournament

This is a rock paper scissors competition. Algorithms will face each other in 100 rounds of rock paper scissors. Except that the algorithms will also be able to read the source code of each other! ...
1
vote
0answers
89 views

Random musical harmonies [closed]

The challenge. Make a program that produces a random series of 8 notes in the scale of E minor, and then harmonizes them. Details. Notes must be represented in output as a 1-2 char string, which ...
2
votes
0answers
127 views

Solve the Trolley Problem with Multitrack Drifting [closed]

Introduction Programmers have already solved the trolley problem (a classical problem in philosophy). In the usual trolley problem, we have a directed graph and each edge is weighted by the number of ...
39
votes
8answers
2k views

Constructing an evil maze against random exploration

RollerCoaster Tycoon 2's maze is the inspiration for this question. Credit to Marcel Vos for thoroughly breaking the classic RCT2 AI. The pathfinding AI in this question is the AI in the latest ...
1
vote
7answers
139 views

bandit24 brute forcing program [closed]

I was doing the bandit wargame from overthewire.org and because I am a script kiddie, I googled the answer for level 24. ...
29
votes
42answers
3k views

How many 1's we get

Description Count how many occurrences there are of the digit 1 between two given numbers \$[a, b]\$, inclusive. For example, from 1 to 100 it should be 21: 1, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19,...
10
votes
2answers
178 views

Minimal cost path in wall-breaking maze

Inspired by this Puzzling challenge. Challenge Given a 2D rectangular grid where each cell is either an empty space or a wall, find the path (or one of the paths) from the top left cell to the bottom ...
-6
votes
1answer
65 views

Maximum cap set in ASPIF (clasp grounded input format) [closed]

Write an ASP program to find a maximum cap set (https://en.wikipedia.org/wiki/Cap_set) for n dimensions. Winner generates an instance for maximal dimensions that grounds in less than a minute on your ...
13
votes
4answers
511 views

Find the maximum flow

Given a directed network, with a single source and a single sink, it is possible to find the maximum flow through this network, from source to sink. For example, take the below network, \$G\$: Here, ...
7
votes
3answers
189 views

Domino Recurrence Generator

Challenge We once had a challenge to count domino tilings of m by n grid, and we all know that, for any fixed number of rows, the number of domino tilings by columns forms a linear recurrence. Then ...
9
votes
1answer
198 views

Thin Paper Folding

Thin Paper Folding This is a "lighter" version of the challenge Paper Folding for the win. This challenge is being posted as a different challenge with many modifications in order to try ...
31
votes
18answers
3k views

Cat, Quine, Hello World

Write a cat program, a quine, and a Hello World in the same language such that when two specific programs of the three are concatenated in a certain order, you get the third program. It does not ...
20
votes
43answers
4k views

Draw an ASCII-art rainbow

Draw an ASCII-art rainbow! Input An integer between 0 and 1000, inclusive. Examples Input 0: /\ || Input 1: _ / \ | | Input ...
0
votes
6answers
1k views

Fastest prime printer up to 500,000,000 [closed]

Write a program to print the first 26,355,867 prime numbers, from 2 to 499,999,993 inclusively. Or in other words, print all the prime numbers smaller then 500,000,000. The fastest code wins! Update ...
23
votes
23answers
2k views

Antisymmetry of a Matrix

A matrix is antisymmetric, or skew-symmetric, if its transpose equals its negative. The transpose of a matrix can be obtained by reflecting its elements across the main diagonal. Examples of ...
-4
votes
0answers
87 views

No cows necessary [closed]

Tired of having to read tons of English about farmer Betty's cows to solve a problem? In this puzzle, the scoring objective is defined by the following "glass-box" python3 function. The ...
-9
votes
0answers
84 views

Hello world python riddle [closed]

...
16
votes
2answers
256 views

Give Me a Ladder!

I think everyone is familiar with the game of snakes & ladders1. Imagine we have a 10x10 board like this: ...
0
votes
16answers
389 views

Find your dog's age

Task Take the (integer) number of human years that the dog has lived, \$n\$, as input and return its age in dog years, \$d\$, to two decimal places. The number of human years, \$n\$, will be between \$...
7
votes
0answers
186 views

Shift Tac Toe - Code Golf Challenge

Shift Tac Toe Shift Tac Toe is a game that combines Tic Tac Toe and Connect 4 together. In this game, you start with a 3 by 3 board, and each row is connected to a slider that you can move left and ...
3
votes
0answers
129 views

Sums of permutations of vectors [closed]

I am looking for a more efficient way of computing the following. Let A and B be two vectors of non-negative integers of length <...
16
votes
1answer
309 views

Paper Folding for the win

Paper Folding for the win "How many times can you fold a paper?" - This well known question led to many arguments, competition, myths and theories. Well, the answer to that question depends ...
8
votes
3answers
514 views

Separating the _____ from the _____ [closed]

There are two types of people in this world: users and admins. Let's find out who the real admins are. The task is simple: If the script is run with elevation, print 'True' and only 'True' (only ...
24
votes
18answers
3k views

Legendre's (Unsolved) Conjecture

Legendre's Conjecture is an unproven statement regarding the distribution of prime numbers; it asserts there is at least one prime number in the interval \$(n^2,(n+1)^2)\$ for all natural \$n\$. The ...
13
votes
13answers
1k views

Help me accelerate linear recurrence relation!

Background A linear recurrence relation is a description of a sequence, defined as one or more initial terms and a linear formula on last \$k\$ terms to calculate the next term. (For the sake of ...
18
votes
12answers
2k views

Slowing Down Sped Up Videos

Summary Videos which are sped up every time a particular word is said exist for everything from the Bee Movie to the classic Rick Roll. The goal for this challenge is to figure out how much you'd have ...
14
votes
5answers
389 views

Play a Game of Minigolf

Background I feel that for a site named code-golf we have a shockingly little amount of golf being played. Let's fix that. Challenge Determine whether the hole of a minigolf course can be reached ...
11
votes
0answers
175 views

Checkerboard the Matrix

Task Given a matrix, your program/function should output a row-equivalent matrix in checkerboard form ( \$A_{ij}=0\$ if and only if \$i+j\$ is odd). Two matrices are defined to be row-equivalent if ...
36
votes
59answers
4k views

The shortest way to find one unique value when all other values are the same

In this question at Code Review they tried to find the fastest way to return the unique element in an array where all the elements are the same except one. But what is the shortest code that ...
17
votes
5answers
1k views

Where will the gem-picking robot end up?

Related puzzle: Pathfinder (available on Puzzle Picnic) Background A robot is standing on a cell of a rectangular grid, where each cell has one or more gems except for the one with the robot. The ...
29
votes
68answers
6k views

Print X without X (robber's thread)

This is the robber's thread of a cops-and-robbers challenge. You can view the cop's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do ...
50
votes
74answers
7k views

Print X without X (cop's thread)

This is the cop's thread of a cops-and-robbers challenge. You can view the robber's thread here A pretty common beginner style question is to print some string, but, there's a catch!, you need to do ...
14
votes
5answers
511 views

Cantor Function, Cruel

A ripoff of this challenge. Go upvote it! Objective Given a rational number amongst \$[0,1]\$, apply the Cantor function to it and output the rational number that's produced. The Cantor function The ...
0
votes
0answers
14 views

How to get reputation to post on the meta? [migrated]

I'm sorry for posting here instead of on the meta but I'm not allowed to post on the meta. I need 5 reputation here to post in the sandbox. How am I supposed to get that if I am supposed to post in ...
17
votes
39answers
3k views

The ASCII character countdown!

Since this is a answer-chaining challenge, you might want to sort answers by oldest. Your task is simple: Choose any printable ASCII character that's not chosen in the previous answers. And then, you ...
20
votes
18answers
2k views

Verify a Superpermutation

A superpermutation on n symbols is a string which contains every permutation of n symbols in its body. For instance, 123121321 is a superpermutation on three ...
37
votes
36answers
3k views

Hot moo shuffle: milk an array

Background Milking the deck is the name given to the following card shuffling method: 'Pinch' the deck to remove the top and bottom cards simultaneously. (With lots of imagination, this action ...
16
votes
20answers
3k views

And and… and. And.?

Introduction: Inspired by the Puzzling-stackexchange post with the same name, which I've answered four years ago: Can you create a perfectly valid English sentence, which makes perfect sense, but ...

15 30 50 per page
1
2 3 4 5
234