All Questions

Filter by
Sorted by
Tagged with
6 votes
7 answers
39 views

CGAC2022 Day 9: Playing with bits

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. The Elves like playing number games. One day, Bin (a friend of Fen) suggests a new game: given a positive integer <...
  • 67.9k
3 votes
4 answers
81 views

Find the representative submatrix

Note: This is a more limited version of a challenge from 2014 that only received one answer. That challenge required participants write two programs; this challenge is essentially one half of that. ...
  • 8,936
11 votes
4 answers
305 views

Santa's Shortest Path Problem

Santa's Shortest Path Problem Trying to be as time-efficient as possible Santa needs to plan his trips carefully. Given a 5X5 grid representing a map of villages it is your task to be Santa's flight ...
  • 1,421
-1 votes
0 answers
80 views

Highest(non-mate) evaluation that Stockfish can get? [closed]

Not sure if this should be moved to chess. What's the highest evaluation(Black or White) that Stockfish will generate? Example: Parameters: Any version of Stockfish allowed. All depth must ...
  • 9
12 votes
9 answers
379 views

CGAC2022 Day 8: Fen The Wicked, Part 2

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. Fen is a magician Elf. He can cast spells on an array of numbers to produce another number or array of numbers. One ...
  • 67.9k
4 votes
7 answers
912 views

Write a program that prints a program that's almost quine

Your task is to make a program in L that takes n as an input number, output a program p in <...
  • 2,749
10 votes
2 answers
236 views

><> numbers metagolf

I struggle to easily encode big numbers in ><>. If only there was a program that could find the best way for me? What is ><> ...
  • 4,916
0 votes
0 answers
33 views

Filter Out 0 outbound value transaction from etherscan API [closed]

I'm working on a small project - A plot of historical tokens amount in ETH address. I'm using Python and etherscan API https://docs.etherscan.io/api-endpoints/accounts My test subject is Alameda ...
18 votes
20 answers
939 views

CGAC2022 Day 7: Fen The Wicked

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. Fen is a magician Elf. He can cast spells on an array of numbers to produce another number or array of numbers. One ...
  • 67.9k
15 votes
9 answers
941 views

CGAC2022 Day 6: Shuffles with specific "magic number"

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. On the flight to Hawaii for vacation, I'm playing with a deck of cards numbered from 1 to \$n\$. Out of curiosity, ...
  • 67.9k
19 votes
4 answers
2k views

Write a number as a sum of Fibonacci numbers

In 2009, Hannah Alpert described the "far-difference" representation, a novel way of representing integers as sums and differences of Fibonacci numbers according to the following rules: ...
  • 8,597
11 votes
14 answers
1k views

CGAC2022 Day 5: Preparing an advent calendar

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. It's time to prepare an advent calendar, but I've only got a large sheet of rectangular paper, randomly colored red ...
  • 67.9k
13 votes
26 answers
1k views

Output the length of (the length plus a message) [duplicate]

The task is simple. You're given an arbitrary string message. Return that message prefixed with a number, such that the length of that number plus the message equals the number. In other words, the ...
  • 489
16 votes
9 answers
2k views

CGAC2022 Day 4: Can Santa fit down the chimney?

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. Christmas is coming up, and Santa hasn't kept to his diet very well this year. Due to his size, he is getting the ...
  • 1,501
0 votes
0 answers
88 views

Generate an image containing lots of random dots [closed]

Introduction I need a piece of code that is either fairly easily compliable to Windows .exe or fairly easy to be run under Windows that will accept only one parameter -- ...
  • 51
10 votes
9 answers
359 views

CGAC2022 Day 3: \$n\$-dimensional Chocolate Pyramid

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. I've got an infinite supply of \$n\$-dimensional chocolate for some positive integer \$n\$. The shape of the ...
  • 39.1k
16 votes
10 answers
1k views

Find the box by its corners

Given a matrix of integers \$M\$ and a list of four integers \$L\$, find the sub-matrix \$N\$ whose corners are given by \$L\$ and return the sum of its elements. Suppose you're given the list \$L = [...
  • 8,936
14 votes
7 answers
1k views

CGAC2022 Day 2: Self-trapping Elf

Part of Code Golf Advent Calendar 2022 event. See the linked meta post for details. An Elf is hopping on a chessboard which extends infinitely in all four directions. They move like a generalized ...
  • 67.9k
9 votes
14 answers
680 views

Join Columnar Strings

Write the shortest possible program or function that will join a list of columnar strings. For this challenge, columnar strings are defined as one-character-wide strings spanning across multiple lines....
  • 4,503
16 votes
10 answers
1k views

Make the cheapest cut

“Cut” a matrix of integers on the line where the sum of the absolute differences of “severed” neighbors is the least. Example Consider this matrix: ...
  • 8,936
5 votes
4 answers
285 views

Encoder/Decoder for efficient number storage!

Description Inspired by this question, write a program/function to encode a number and a program (possibly the same as the first) to decode a bitstream in variable-length encoding as follows (taken ...
  • 2,178
22 votes
17 answers
2k views

CGAC2022 Day 1: Let's build a chocolate pyramid!

Following last year's event, we're doing Code Golf Advent Calendar 2022! On each day from today (Dec 1) until Christmas (Dec 25), a Christmas-themed challenge will be posted, just like an Advent ...
  • 67.9k
20 votes
10 answers
3k views

Totally random Catan number distributions

I like to play (The Settlers of) Catan on Board Game Arena with totally random number tokens. These tokens determine the production rate of the terrain tiles beneath: There are 18 number tokens, two ...
  • 1,273
0 votes
0 answers
150 views

Bridges of Königsberg [closed]

This is a famous mathematical problem, Named as Bridges of Königsberg Task The bridges of Königsberg is a problem in mathematics which states that the path required for crossing each bridge exactly ...
18 votes
38 answers
2k views

Range of ASCII values

Your task Given a string, output the range of ASCII values. Example Let's say we have the string Hello. We get the ASCII values: ...
  • 3,422
14 votes
6 answers
1k views

Shortest path between two directories

The challenge is to write a program which will find the shortest (least number of characters) command which will navigate to a target directory, given a starting directory, assuming a standard linux ...
  • 149
12 votes
26 answers
2k views

Find the nth number where the digit sum equals the number of factors

(This is OEIS A057531.) Your task Given a positive integer, \$n\$, find the \$n\$th number where the digit sum equals the number of factors Explanation For example, let's take 22: Its factors are \$[1,...
  • 3,422
-8 votes
3 answers
233 views

Fastest code: Does a list of string contains %s, %d, %f, or %r?

The aim is to create an algorithm to detect that one of the string in a small list of strings contains %s, %d, ...
  • 317
36 votes
14 answers
2k views

Base Neutral Numbering System

It frustrates me that when you say "base 16", the 16 is in base 10. We need a base neutral way of writing down numbers when favoring a specific base would be inappropriate. How it works We ...
  • 4,916
9 votes
0 answers
193 views

Is it a legal atomic chess move?

Background and Rules There is a variant of chess called atomic chess, which follows essentially the same rules as normal chess, except that pieces explodes other pieces around them when captured. In ...
  • 10.5k
15 votes
22 answers
2k views

Rarity of a String

Input: A string Output: The rarity of the string, as described below. To find the rarity of a string, follow the steps below. Start with 0. Subtract 3 for each E, A, T, or O in the string. Subtract 2 ...
user avatar
15 votes
14 answers
1k views

1 to N column and row sums

Inspiration There is a problem on the most recent AMC 12B test, the one held on November 16, 2022, which goes like this: (AMC 12B 2022, Question 17) How many \$4\times4\$ arrays whose entries are \$0\...
  • 10.5k
11 votes
2 answers
586 views

Interstellar Cabbages, Wolves, and Sheep

The Cabbage, Wolf, Goat riddle with a twist! Backstory: There’s an intergalactic river than needs to be crossed! Being a space-ferryman you’ve offered some aliens on your small space ferry that can ...
16 votes
17 answers
2k views

Number to letters

Your task Given a numerical string or integer \$\ge 0\$ (which may have leading zeros), convert it to letters using the below rules. Rules Loop through the digits: If the digit is ...
  • 3,422
12 votes
3 answers
432 views

Decide whether a given field of the board game 'Qwirkle' is valid (according to game rules)

The famous game of Qwirkle has simple but intricate rules (See part 2 of this question for a summary of the rules!) The Challenge You are somehow (text input, function parameter, whatever) given a ...
  • 127
4 votes
3 answers
146 views

Intermediate Boolean Algebra Calculator

Background With the success of Simple Boolean Algebra Calculator, I present a more difficult problem. Boolean Algebra concerns representing values with letters and simplifying expressions. The ...
5 votes
2 answers
180 views

Transform a lattice polygon to minimum diameter by shearing

Given is a grid polygon by the list of its integer vertex coordinates arranged along the perimeter, in the form \$(x_1,y_1), (x_2,y_2), \cdots , (x_n,y_n)\$ with \$n \ge 3\$. The polygon is completed ...
14 votes
7 answers
691 views

Implement Casio's M

The task Most Casio calculators featured a variable M, which has 3 operators related to it: M, ...
  • 1,675
8 votes
8 answers
622 views

LS, Part 1: Ana Gram

Warning: Wouldn't you rather answer a challenge about ponies?1 If you have read The Hostile Hospital, you would know that the Baudelaire orphans, from one of the scraps of paper recovered from the ...
19 votes
7 answers
2k views

Farigiraf my Girafarig

A palindrome is a word that is its own reverse. I will define the left palindromic root of a word as the shortest prefix of the word for which the shortest possible palindrome that begins with that ...
10 votes
4 answers
756 views

Implement Perceptron

There was a previous perceptron question but it was closed. Also it required a lot of extra stuff that's not normally part of the perception algorithm like I know it. This question will be much ...
  • 4,916
15 votes
13 answers
1k views

Lengthy numbers type A : remove all occurrences of length

Given a non negative integer number tell if it can be erased by repeatedly removing all occurrences of the length of that number from it including overlapping matches. Erasing means cancel all its ...
  • 10.4k
38 votes
5 answers
4k views

50 digits of π in HQ0-9+-INCOMPUTABLE?

Background HQ0-9+-INCOMPUTABLE?! is a half-joke programming language introduced in Internet Problem Solving Contest 2011, Problem H. HQ9+ is an esoteric programming language specialized for certain ...
  • 67.9k
29 votes
19 answers
2k views

Simple Boolean Algebra Calculator

Background Boolean Algebra concerns representing values with letters and simplifying expressions. The following is a chart for the standard notation used: Above is what actual boolean algebra looks ...
19 votes
12 answers
745 views

As many near-repdigit primes as possible

A near-repdigit number is a positive integer where all the digits are the same, except one. For example 101 and 227 are near-repdigits. A near-repdigit prime is a near-repdigit that is also prime. For ...
  • 1,339
15 votes
5 answers
477 views

Perfect Nontransitive Sets

Background For the purposes of this challenge, we'll define a "perfect nontransitive set" to be a set \$A\$ with some irreflexive, antisymmetric relation \$<\$, such that for all \$a \in ...
24 votes
20 answers
2k views

"Prime" pyramid

The pyramid begins with the row 1 1. We'll call this row 1. For each subsequent row, start with the previous row and insert the current row number between every ...
  • 13.4k
21 votes
10 answers
1k views

Traverse a rectangle's antidiagonals

There exists a bijection between the natural and rational numbers that works (approximately) like this: You create a 1-indexed 2-dimensional grid. In every field of this grid with position ...
  • 313
-10 votes
11 answers
274 views

Check if my input was 'hi whats up' without using any of those letters in your code

Write a script, program or function which takes one input of type string and outputs or returns some sort of indication wether the input string was 'hi whats up' (without the apostrophes) or not. You ...
  • 127
21 votes
6 answers
2k views

For xor Young (15+)

A Young diagram is a rectangular binary mask whose every row and every column are sorted in descending order. It is easy to check that every rectangular binary mask can be formed by xor-ing together a ...
  • 11.5k

15 30 50 per page
1
2 3 4 5
268