All Questions

Filter by
Sorted by
Tagged with
2 votes
1 answer
63 views

Search the deepest depths of an array

Given a ragged array, find the length of the largest subarray that contains the depth of that subarray. The base array layer has a depth of 0. Here is an example: ...
Alan Breadel's user avatar
  • 3,933
-1 votes
0 answers
50 views

People who know the secret? [closed]

Output the most number of people who know the secret (It's not a general programming question rather it's from a contest only) I was trying to solve a problem which says to count the number of people ...
Vaibhav's user avatar
  • 11
4 votes
3 answers
172 views

Egyptian fraction representations of 1 without prime denominators

Background As noted in this question, for all positive integers \$n>2\$ there exists at least one Egyptian fraction representation (EFR) of \$n\$ distinct positive integers \$a_{1} < a_{2} < \...
Max Muller's user avatar
5 votes
3 answers
146 views

Is the king in check?

Challenge: Given a 2D array (8x8) of characters, is the enemy king in check? The program should return true if and only if the king is currently in check. Standard chess rules apply. Specifications: ...
Mickey's user avatar
  • 51
5 votes
6 answers
311 views

Floating point numbers... dar nu-mă, nu-mă iei!

When you leave, my challenges fade to grey, 0A0AE16, 0A0A0AE16... A while ago, I made this programming language (https://esolangs.org/wiki/Dragostea_din_tei) which uses an interesting number system. ...
HelloWorld's user avatar
11 votes
8 answers
589 views

Sum up snail number neighbours

Input: You are given two numbers n and m. Create the snail: Fill an n * ...
Philippos's user avatar
  • 2,371
17 votes
35 answers
1k views

Swap letter cases

Given a string containing only printable ASCII (codepoints 0x20 to 0x7E), write the shortest program or function that swaps the cases of A-Z and ...
bigyihsuan's user avatar
  • 9,168
17 votes
24 answers
2k views

Strings without twin letters

Consider an arbitrary set of letters \$L\$. It may either be \$\{A, B, C\}\$, \$\{M, N, O, P\}\$, \$\{N, F, K, D\}\$, or even contain all the 26 letters. Given an instance of \$L\$ and a positive ...
enzo's user avatar
  • 1,943
8 votes
5 answers
688 views

Compute the phat-fingered double-bit-flip distance

Recall from this challenge that a phat-fingered double-bit flip or phatflip is defined as follows: Given a nonnegative integer in binary representation a phat-fingered double-bit-flip or phatflip for ...
loopy walt's user avatar
  • 16.6k
1 vote
2 answers
693 views

Compiler for LaTeX

Problem: Given a string representing a mathematical expression with constants (pi, e, psi, i), basic arithmetic operations (+, -, *, /), parentheses, fractions, and exponentiation, write a program or ...
3.14's user avatar
  • 373
10 votes
13 answers
1k views

Enumerate the Phat-fingered-lights-out numbers

Even though the concept of phat-fingered-lights-out number should be pretty self-explanatory here is a definition: Given a nonnegative integer in binary representation a phat-fingered double-bit-flip ...
loopy walt's user avatar
  • 16.6k
9 votes
4 answers
679 views

Find the Chess960 starting positions from its integer ID

Chess960, a.k.a. Fisher random chess, is a variation of the game of chess. In classic chess the starting positions are always the same. In chess960 they vary. Before each game of chess960 one random ...
Kjetil S's user avatar
  • 5,857
15 votes
20 answers
2k views

Spot The Difference

Challenge Generate two \$16 \times 16\$ grids, each initially filled with "@" symbols and spaces. Each cell in the grids should be independently filled with an "@" or a space, with ...
vengy's user avatar
  • 1,643
4 votes
2 answers
314 views

Compact Binary Representation

Background Often, when storing a number in binary with some maximum, we simply round the maximum to the next power of two then allocate the number of bits nececairy to store the whole range. Lets call ...
mousetail's user avatar
  • 12.4k
12 votes
16 answers
2k views

The primitive circle problem

Challenge The primitive circle problem is the problem of determining how many coprime integer lattice points \$x,y\$ there are in a circle centered at the origin and with radius \$r \in \mathbb{Z}^+ \...
vengy's user avatar
  • 1,643
26 votes
23 answers
1k views

Remove falsy rows and columns

Your challenge is to, given a matrix of nonnegative integers, remove all rows and columns that contain a 0. For example, with this matrix: ...
emanresu A's user avatar
  • 37.1k
11 votes
15 answers
946 views

Compute maximum excluding the current position

Given an array of integers A, the task is to output another array B of the same length so that B[i] is the maximum over A for every index that is not i. That is \$B[i] = \max_{i' \ne i} A[i']\$. ...
Simd's user avatar
  • 2,770
-8 votes
1 answer
235 views

Print Goodbye World instead of Hello World

Make a cat program, with a catch. The program must refuse under all circumstances to output "Hello World", instead outputting "Goodbye World", with matching spacing (but matching ...
Devsman's user avatar
  • 145
16 votes
14 answers
3k views

TYPOGLYCEMIA - Cna Yuo Raed Tihs?

What is Typoglycemia? Typoglycemia is a term that refers to the phenomenon where readers are able to understand text even when the letters in the middle of words are jumbled, as long as the first and ...
vengy's user avatar
  • 1,643
18 votes
11 answers
2k views

Is it a valid ARM immediate value?

Exposition In this challenge, I am talking about ARM assembly language. ARM is a 32-bit RISC processor; I'll use instruction set up to architecture v6. To load a constant ("immediate") value ...
anatolyg's user avatar
  • 13.4k
14 votes
13 answers
1k views

Counting rankings

There is a competition with \$n\$ participants in total. Alice is one of the participants. The outcome of the competition is given as a ranking per participant with a possibility of ties; e.g. there ...
Bubbler's user avatar
  • 75k
3 votes
4 answers
600 views

Fastest count of certain hypercubes with labeled vertices

CHALLENGE This is a fastest-code challenge. Count how many n-dimensional hypercubes with n=1,2,3,4 exist, with vertices labeled with either 1 or 0, such that there does not exist any rectangle formed ...
Fabius Wiesner's user avatar
0 votes
0 answers
235 views

How quickly can you type this string?

Given a string consisting of only printable ascii (letters, numbers, symbols, and spaces), how many keystrokes are required minimally to type out this string from scratch? That is, current text is ...
Alan Breadel's user avatar
  • 3,933
17 votes
25 answers
2k views

What and where is the max?

This small challenge derives from my annoyance at discovering that numpy doesn't have a built in function for it. Input An n by m matrix of integers. Output The maximum value in the matrix and the 2d ...
Simd's user avatar
  • 2,770
3 votes
5 answers
354 views

Generate a sequence of \$n\$ consecutive composite numbers

Definitions The common methods to generate consecutive composites are $$\overbrace{(n+1)! + 2, \ (n+1)! + 3, \ \ldots, \ (n+1)! + (n+1)}^{\text{n composites}}$$ $$\overbrace{n!+2,n!+3,...,n!+n}^{\text{...
vengy's user avatar
  • 1,643
1 vote
8 answers
277 views

Alternating Random Series Sum To \$N\$ [closed]

Challenge Given a positive integer \$N \ge 3\$, generate an alternating series of \$N\$ random numbers within the range \$[1, N]\$, such that their sum equals \$N\$. Expressed mathematically as $$N = ...
vengy's user avatar
  • 1,643
-1 votes
8 answers
1k views

Number of cigarettes that can be made from a given number of butts

Assumption A cigarette can be made by combining four cigarette butts. Cigarette butts last infinitely until smoked. Explanation Say you have 31 butts. That means, you can make 7 cigarettes from 28 ...
Siddharth Singh's user avatar
-4 votes
0 answers
109 views

Solve a logic puzzle by exhaustively applying three rules to rows and columns of a table

Sussing It Out (The Core Part) How good is your logical reasoning? In this challenge, you'll rewrite an existing program that solves simple logic puzzles like those published in Dell, Penny Press, ...
oldsoul's user avatar
8 votes
3 answers
152 views

3D Hide & Seek Word Puzzle - Seeker edition

Your code-golf challenge is to find all occurences of a word in the 3d matrix. There is no restriction on I/O format. In the samples below, the word is presented, then a blank line, then the 2-...
Sny Smartie's user avatar
-2 votes
1 answer
170 views

Solving Reverse Polish Notation with GolfScript and Eval Function

I am exploring a unique approach to the classic problem of Reverse Polish Notation on code.golf. Unlike the conventional solutions, my focus lies on leveraging the ...
Golfscript-Noob's user avatar
5 votes
4 answers
445 views

3D Hide & Seek Word Puzzle

Challenge Create a 3D word puzzle where the cube's dimensions match the length of the input word. The uppercase word (A-Z) must be validly placed within the cube in one of the fixed orientations: ...
vengy's user avatar
  • 1,643
4 votes
5 answers
592 views

Double-reduce a sequence of integers

Consider a function \$r\$ where $$ r(i,k)= \begin{cases} L_{i+1}-L_i, & \text{if}\ k =0\ \text{ (1st reduction)} \\ r(i,0)-r(\lfloor \log_2{k} \rfloor,k-2^{\lfloor \log_2{k} \rfloor}) & \text{...
enzo's user avatar
  • 1,943
0 votes
3 answers
594 views

Find the best staircase to maximize the sum

Given an \$n \times n\$ matrix of integers, The task is to find the optimal dividing line that maximizes the sum of the integers on the same side as the top left corner. The dividing line should be ...
Simd's user avatar
  • 2,770
3 votes
1 answer
188 views

Output intervals for the optimal subarrays

Consider an array A of integers of length n. The k-max subarray sum asks us to find up to \$k \leq 3\$ (contiguous) non overlapping subarrays of A with maximum sum. If A is all negative then this ...
Simd's user avatar
  • 2,770
12 votes
20 answers
1k views

Modular Equivalence

Given two numbers \$x,y > 2, x≠y \$ output all integers \$m\$ such that $$ x + y \equiv x \cdot y \pmod m $$ $$ x \cdot y > m > 2 $$ Input Two integers Output A list of integers Test cases <...
pacman256's user avatar
  • 3,330
0 votes
0 answers
82 views

Print my submission entry [duplicate]

Your program should print the following: **Language, XXX bytes** ``` CODE ``` or its equivalent. XXX should be substituted by ...
Sny Smartie's user avatar
13 votes
19 answers
1k views

The TAK function (easy mode)

The TAK function is defined as follows for integers \$x\$, \$y\$, \$z\$: $$ t(x, y, z) = \begin{cases} y, & \text{if $x \le y$} \\ t(t(x-1,y,z), t(y-1,z,x), t(z-1,x,y)), & \text{otherwise} \...
Bubbler's user avatar
  • 75k
9 votes
7 answers
593 views

Possible moves in Othello/Reversi

Othello/Reversi is a board game in which players take turn placing pieces of a color (dark or light) on the 8x8 board. The possible moves are positions where there are one or more pieces of the ...
Yousername's user avatar
  • 3,930
12 votes
7 answers
1k views

Horsey sightseeing

A knight's tour is a sequence of moves of a knight on a chessboard such that the knight visits every square only once. For those who are not aware of how knights in chess work, knights are capable of ...
totallyhuman's user avatar
  • 16.7k
0 votes
2 answers
180 views

The many ways to skin a `cat` [duplicate]

The well known cat command simply copies its stdin directly to stdout unchanged. But there are plenty of other commandline tools that exist... What other commands ...
CarmenCarmen's user avatar
2 votes
0 answers
249 views

Implement the simplest functional programming language

The goal of this challenge is to compare how well different programming languages support functional programming, by seeing how much code it takes to implement BLC8, the simplest functional ...
John Tromp's user avatar
  • 1,176
7 votes
4 answers
366 views

Busy Letters & Evil CEOs

Imagine you are given an array/string containing \$5\$ letters of the English alphabet, with each letter having any value from A to Z (inclusive). Every day, each letter will perform a job, which can ...
Trivaxy's user avatar
  • 337
9 votes
11 answers
2k views

Solve a squared cryptarithm

Inspired by Greg Martin's "Shiny cryptarithm" puzzle. A cryptarithm is a game consisting of a mathematical equation among unknown numbers, whose digits are represented by letters of the ...
enzo's user avatar
  • 1,943
18 votes
7 answers
1k views

The TAK function

The TAK function is defined as follows for integers \$x\$, \$y\$, \$z\$: $$ t(x, y, z) = \begin{cases} y, & \text{if $x \le y$} \\ t(t(x-1,y,z), t(y-1,z,x), t(z-1,x,y)), & \text{otherwise} \...
Bubbler's user avatar
  • 75k
7 votes
3 answers
341 views

Relaxing Romans

The Roman numeral for 499 is usually given as CDXCIX which breaks down as CD + XC + IX = 400 + 90 + 9 where numerals like ...
doubleunary's user avatar
  • 1,388
16 votes
11 answers
1k views

Find the finest building blocks

Given a string \$X\$ we will say two strings, \$a\$ and \$b\$, are building blocks of \$X\$ if \$X\$ can be made by concatenating some \$n\$ \$a\$s with \$m\$ \$b\$s in any order. For example the ...
Wheat Wizard's user avatar
  • 97.7k
13 votes
20 answers
2k views

Complete a Mystery Sequence

Given a sequence of three integers, determine if the sequence is arithmetic (of the form [a, a+d, a+2*d]) or geometric (of the form ...
nyxbird's user avatar
  • 313
9 votes
9 answers
687 views

Validate a codice fiscale

Validate a codice fiscale Every Italian resident/citizen is given a 16-character alphanumeric codice fiscale Challenge The final letter is a check code, which is calculated as follows : Characters of ...
Nicolas Formichella's user avatar
8 votes
1 answer
342 views

Longest Repeating Subarray (With Overlapping)

Earlier I asked about this problem on stackoverflow (link), but now I also want to see the golfiest solutions Problem: Given an array of arbitrary numbers, what is the longest subarray that is ...
user23274861's user avatar
7 votes
10 answers
923 views

Make 1's and 2's composite

Input An integer k composed of 1 and 2, with at least 3 digits and at most 200 digits. ...
Sny Smartie's user avatar

15 30 50 per page
1
2 3 4 5
280