New answers tagged

0

I am not a dad! Task Given a non-empty string. Check if it starts with "I am"/"I'm" (case-insensitive) and if it is, output the dad joke. Otherwise, terminate. There are some exceptions which you can see in the Examples section. P.S. There must be nothing in the STDERR under normal circumstances. By abnormal circumstances I mean the cases ...


2

Generalised multi-dimensional chess knight's moves code-golf combinatorics chess array-manipulation Multi-dimensional chess is an extension of normal chess that is played on an 8x8x8x8... "board". In normal 2D chess, a knight's move is a movement by a vector of \$ \begin{bmatrix} \pm 2 \\ \pm 1 \end{bmatrix} \$ or \$ \begin{bmatrix} \pm 1 \\ \pm 2 \...


1

Consecutive Distance Rating code-golf array-manipulation integer We'll call the consecutive distance rating of an integer sequence the sum of the distances between consecutive integers. Consider 2 9 3 6 8 1. 2 9 3 6 8 1 <----5----> <-2-> <--3--> \$2\$ and \$1\$ are consecutive integers, and their distance apart in the sequence is \$5\$. \...


1

Side to side, not up and down code-golf binary-tree Given a list of nodes representing a binary tree of positive integers serialized depth-first, return a list of nodes representing the same tree serialized breadth-first. To represent an absent child, you may use null, 0, 'X', Nothing, [], or any other value that is distinct from your representation of a ...


2

Full clean-up and improved reviewing tools This would be a two-part plan to make the sandbox a better experience both for new users, and longtime reviewers. Clean-up This is something that's been discussed quite often. There are various ways to go about it, but the goals would be (at minimum): Adopt quality abandoned proposals Delete posted or low quality ...


0

Given matrix \$A\$ and \$A^n\$, solve \$n\$. Sandbox Notes Since this question likely fall into pure matmul as code-golf, will this be fastest-code? If so, what size and \$n\$ is reasonable? Should it multiply in a modulo-\$p\$ ring? If someone provide enough extra info, they have right to post this question(actually that's why I posted in sandbox)


0

Binomial transform code-golf math sequence integer Background Binomial transform is a transform on a finite or infinite integer sequence, which yields another integer sequence. It has an interesting property that applying the transform twice will yield the original. TODO: insert the formula Task Compute the binomial transform of a given finite sequence. Test ...


1

A Cat’s Game to Claim For every move in Tic Tac Toe, there should be at least one way to draw that includes that move. Or so it seems; prove me wrong! Challenge: Given a turn and a square, print a draw with that move. Any input/output is accepted. But here is the convention I’ll use in the examples: There are 9 squares on the boards, and 9 turns in a drawn ...


1

king-of-the-hill Floating Point Prisoners Dilemma Background So, nowadays the popular Prisoner's Dilemma variant is the Prisoner's Trilemma, where there are three options. I can easily see that being increased, so I figured Why settle for three options, when we can have INFINITE options? Therefore, I created the Floating Point Prisoner's ?Lemma. Technical ...


2

Is there a left-right connection? code-golf path-finding binary-matrix decision-problem Task Given a square array of 0s and 1s, determine whether or not there exists a path of 1s connecting the leftmost and rightmost columns. A path can take steps of one unit up, down, left or right, but not diagonally. Every symbol on the path must be a 1, and it must ...


1

Trapezoidal Riemann Sum Given a list of coordinate pairs, output the Trapezoidal Riemann Sum of the values given between the first and last x-coordinates. You will be given a list of sorted coordinate pairs, like this: [ [1,2], [3,5], [5,11] ] My way to do this is (you might find a different way): Get pairs of coords: [1,2],[3,5] and [3,5],[5,11] For ...


0

Convert permutations to integers and back again permutations encode decode Convert a permutation of 0,...,n-1 to a number in the range 0,...,n!-1, and convert back again. Task Write a program containing two functions (or two programs). The first function should accept a permutation (i.e. an ordering) of the numbers 0,1,2,...,n-1 (where n is any positive ...


0

Interpret Unreadable code-golf interpreter Introduction Unreadable is a programming language designed to be – as the name states – unreadable (in most fonts, anyway). Instructions are ' followed by a run of "s. So while in a code block, '""'""'""" looks just fine, it looks like '""'""'""&...


0

Write a netquine There are a lot of online interpreters, for a lot of languages. For example, there's the ubiquitous TIO, but there are also smaller, more specific ones that others have made, such as interpreters for Vyxal, ngn/k, or Grok. Your goal today is to write a netquine, or a program whose output, when used as a URL, leads to that program in an ...


2



0

Boxes in boxes in boxes in boxes..... ASCII boxes are fun, but the box drawing questions seem to be limited insofar as that they seem to take a specific set of boxes. Today, I hope to fix that. The challenge here is to write a program that takes a list of sides of boxes and characters to draw them with, and outputs the boxes. To clarify some format issues: ...


0

Smallest number of actions to change reputation by [x] points 8: Upvote + downvote 75: Bounty + upvote + accepted answer Draft


0

Finite Composition of Univariate Functions math code-golf Problem Given $$\mathbb{F}:=\{f_i \mid f_i : \mathbb{R} \to \mathbb{R}\}$$ the set of all the real maps, and the n-ary function composition \begin{gather} c_o(f_i) = f_1∘f_2∘f_3⋯∘f_n\\[8pt] ∀f_i ∈ \mathbb{F},~~~1≤i≤n∈\mathbb{N} \end{gather} write a program which receives n functions of a real variable ...


0

Does the regex match the string? Despite having over 80 challenges tagged regular-expression, we don't have one to simply verify if a regex matches a string. Given a regular expression \$R\$ and a string \$S\$, output one of two distinct and consistent values to indicate whether the regex matches the string. You may assume: The input and output will be in ...


1

Combinatorial Pipes math combinations You're a plumber working on a house, and there's some pipes that must be connected at odd angles. You have 8°, 11.25°, 22.5°, 45°, and 90° fittings at your disposal, and you want to use as few as possible to match the angle as closely as possible. Goal Match the desired angle as closely as possible, with as few fittings ...


1

How much faster than qsort can you achieve? Task Sort 1 million 32 bit integers as quickly as possible. Your code must create 1 million random non-negative integers in the range 0 to 999999 and sort them. Only the sorting should be timed. Score I will run your code and compare the timings to my default C code using qsort. That is: #include <stdio.h> #...


1

Is this a Permutation code-golf decision-problem array-manipulation permutations Input a non-empty array with \$n\$ positive integers. Test if the input array contains every integers in \$1\cdots n\$. In case you prefer 0-indexed numbers, you may choice to input an array of non-negative integers, and test if the input array contains every integers in \$0\...


3

Implement Fix2 code-golf functional-programming lambda-calculus Background The fixed-point combinator \$\textsf{fix}\$ is a higher-order function that computes the fixed point of the given function. $$\textsf{fix}\ f = f\ (\textsf{fix}\ f)$$ In terms of programming, it is used to implement recursion in lambda calculus, where the function body does not ...


3

Non-quining infinite printer Seems like the title could be better but I'm not sure what to do instead code-golfquinestring I have heard that a monkey typing random keys on a typewriter, given infinite time, will eventually type out the entire works of Shakespeare, and in fact type out every possible string of characters of any length. This sounds to me like ...


1

Task You are an angry dude who manages the servers, but you are terrible in it. People often text you, and sometimes they ask why are the servers down - you got very annoyed! Given a non-empty string. If it contains "server" and "down" (capitalization doesn't matter), you infinitely output the >:( face with a newline after. If it doesn't, you only output "Hi"...


2

Decode USB packets code-golf binary coding-theory encoding Posted


1

Encode USB packets code-golf binary coding-theory encoding Posted


2

Shuffle a contiguous subset of a list code-golf array-manipulation random Idea shamelessly stolen from caird and rak1507 Shuffle a contiguous subset of a list of unique, positive integers randomly, given the start and end indices of that subset. For example, given the list \$[A, B, C, D, E, F, G, H]\$ and the indices 0 and 5 (0-indexed, with an exclusive end)...


1

Shuffle a subsequence Thanks to rak1507 for the suggestion "Random" in this challenge always refers to "uniformly random" - of all possible choices, each has an equal chance of being chosen. Uniform shuffling means that every possible permutation of the array has an equal chance of being chosen. Given an array consisting of positive ...


-1

Breaking BogoBogoSort (In Badness) code-golfmatharray-manipulationcombinatoricsrandom The title says it all - make a sorting algorithm with a time complexity of \$O(n!^{n!})\$ or higher in the fewest bytes possible - as far as I can tell, that will require you to make a double exponentiatial formula or worse: that is, \$O(a^{b^n})\$, where \$a, b > 1\$. ...


3

Write a C++ demangler code-golfstringparsing If you have ever looked at an objdump of a C++ program, you have likely seen something like this: _ZN3foo3bar3bazI6sampleEE3quxvi3foo This is a C++ mangled symbol, which encodes the namespaces, classes, and function/template arguments, using the Itanium ABI. Specifically, it is for the following function: void ...


0

branch golfing: sort a list by number of prime factors Specifically, first sorted by total number of prime factors, with any ties broken by number of unique prime factors (remove this?), then broken by size. The list will never contain 1. Test cases: [4,5,6,9] -> [5,4,9,6] [10,11,12] -> [11,10,12] [360 200 12] -> [12 200 360] [63 64 65] -> [65 63 ...


0

Random Prisoner's Trilemma - Python 3 KOTH


0

Yet another digit insertion problem


1

Salvage My Chemistry Homework Introduction I pulled an all-nighter yesterday doing my Chemistry homework. However, I now realize that was a terrible idea, because my handwriting was too sloppy and now I can’t distinguish the capital letters from the lowercase letters in my chemical formulas! This is a problem, because now the formulas can mean completely ...


1

Is it a Fischer random chess starting board?


1

Construct a Modulo Multiplication Table


0

Optimize imnotdeadfish


4

I'm Lazy*: Top-left align my text code-golfstringarray-manipulationmatrix posted


3

I'm Lazy: Close my Parens stringcode-golfparsingbalanced-stringlisp


0

What sequence? answer-chainingsequence Stack Exchange distinguishes users by a unique id that can be found in their their profile URL. You can find your id by navigating to https://codegolf.stackexchange.com/users/current and finding the number after the /users/ bit in the resulting URL. For example, my profile URL is https://codegolf.stackexchange.com/users/...


0

Counting uniquely solvable polylinks code-golf grid polyomino combinatorics puzzle-solver Related: Counting polystrips Background Link-a-Pix is a puzzle on a rectangular grid, where the objective is to reveal the hidden pixel art by the following rules: Connect two cells with number N with a line spanning N cells, so that the two cells are at the two ends ...


0

Demonstrate some easier abstract algebra From my related challenge, Demonstrate some advanced abstract algebra Consider a binary operator \$*\$ that operates on a set \$S\$. For simplicity's sake, we'll assume that \$*\$ is closed, meaning that its inputs and outputs are always members of \$S\$. Let's define some basic terms describing the properties of \$*\$...


2

Split a list into maximal equal-sum sections


2

Create an ascii line given length


1

Determine Centrosymmetric String code-golf, string, decision-problem Let's define a centrosymmetric string as follows: First, add spaces to the end of each line to make the input a rectangle \$ A_{m×n} \$. The input is "centrosymmetric" string if and only if you get the original rectangle if you rotate the rectangle 180°. That is, it has 2-fold ...


0

Pickleball Doubles Scoring


3

But, Is It Art?


0

Conic Sections (simplified) code-golf math characteristics Given the equation of a non-parabolic conic section, output its characteristics. Spec This assumes prior knowledge of hyperbolas and ellipses, as well as their characteristics. (This includes circles; they are a special case of the ellipse with eccentricity of zero.) Input A non-parabolic (to ...


0

Is this a trivial brainfuck NOP? code-golf string decision-problem halting-problem brainfuck Brainfuck is Turing-complete*, which means determining the behaviour of an arbitrary program is undecidable. However, we can get arbitrarily close to this if we limit ourselves to detecting a limited subset of programs. For this challenge, we will detect a limited ...


Top 50 recent answers are included