instruction stringlengths 34 53.1k |
|---|
Challenge
You will be given an input represented by x, which is a string containing at least 3 characters. It will consist only of the standard numeric characters, 0 through 9. Your job is to find and output how many right triangles can be formed with the given numbers.
Rules
Numbers must be kept in the order they wer... |
Introduction
The idea is to use the asterisk character (star) * to display an ascii-art star at a specified dimension. The dimension is an input number greater than or equal to \$1\$ that specifies the height in lines of the upper point of the star. The stars here are intended to be six pointed stars with larger sizes ... |
Introduction (may be ignored)
Putting all positive numbers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive numbers. This is the fifth challenge in this series (links to the first, second, third and fourth challenge).
I... |
You are given an array/list/vector of pairs of integers representing cartesian coordinates \$(x, y)\$ of points on a 2D Euclidean plane; all coordinates are between \$−10^4\$ and \$10^4\$, duplicates are allowed. Find the area of the convex hull of those points, rounded to the nearest integer; an exact midpoint should ... |
The New York Times has a daily online game called Letter Boxed (the link is behind a paywall; the game is also described here), presented on a square as follows:
You are given 4 groups of 3 letters (each group corresponds to one side on the picture); no letter appears twice. The aim of the game is to find words made o... |
Write a program, given an input n, will generate all possible n-tuples using natural numbers.
n=1
(1),(2),(3),(4),(5),(6)...
n=2
(1,1),(1,2),(2,1),(2,2),(1,3),(3,1),(2,3),(3,2),(3,3)...
n=6
(1,1,1,1,1,1) (1,1,1,1,2,1) (1,1,1,2,1,1)...
The output may be in any order that does not break any other rules.
The program... |
Your goal is to write a program that takes no input and outputs the following text:
ca e na ŋa va o sa;
þa ša ra la ła.
ma a pa fa ga ta ča;
în ja i da ða.
ar ħo ên ôn ân uħo;
carþ taŋ neŋ es nem.
elo cenvos.
But there's a catch: for each letter (any character whose general category in Unicode starts with L) in your s... |
Python is the fastest-growing major programming language today. It is the most wanted language for the third year in a row, meaning that developers who do not yet use it say they want to learn it.[1]
The reason for Python's popularity is its many versions.[citation needed] There are in fact 116 versions of Python, incl... |
Given some positive integer \$n\$ that is not a square, find the fundamental solution \$(x,y)\$ of the associated Pell equation
$$x^2 - n\cdot y^2 = 1$$
Details
The fundamental \$(x,y)\$ is a pair of integers \$x,y\$ satisfying the equation where \$x\$ is minimal, and positive. (There is always the trivial solution \$... |
This! is an RGB colour grid...
Basically it's a 2-dimensional matrix in which:
The first row, and the first column, are red.
The second row, and the second column, are green.
The third row, and the third column, are blue.
Here are the colours described graphically, using the letters R, G, and B.
Here's how we calcu... |
You want to create a square chessboard. Adjacent tiles must alternate black and white like a standard chessboard, and the bottom left corner can be either black or white.
Your program will take in two positive integers, the number of black and the number of white tiles. These will always be less than 1024. You don't ha... |
Introduction:
A 3x3x3 Rubik's Cube has \$43,252,003,274,489,856,000\$ possible permutations, which is approximately 43 quintillion. You may have heard about this number before, but how is it actually calculated?
A 3x3x3 Rubik's Cube has six sides, each with nine stickers. Looking at the (external) pieces instead of sti... |
Introduction:
Inspired by these two SO questions (no doubt from the same class): print the elements in the subarray of maximum sum without adjacent elements java and Maximum sum of non adjacent elements of an array, to be printed.
Challenge:
Given a list of integers, output a subsequence consisting of non-adjacent elem... |
I came up with a series of numbers the other day and decided to check what the OEIS number for it was. Much to my surprise, the sequence did not appear to be in the OEIS database, so I decided to name the sequence after myself (note that someone else who's a lot smarter than me has probably already come up with this, ... |
Introduction (may be ignored)
Putting all positive integers in its regular order (1, 2, 3, ...) is a bit boring, isn't it? So here is a series of challenges around permutations (reshuffelings) of all positive integers. This is the sixth challenge in this series (links to the first, second, third, fourth and fifth chall... |
This happy individual is known in folklore as the Easter Bunny.
Colours
It is created using 4 colours:
Light pink
Dark pink
White
Black
(I'm happy for these colours to be approximated in your answer. It does not need to be this precise shade)
Shapes
It is constructed of these shapes:
Two tall ellipses in light pink... |
Each day you put up a new word on a marquee sign with movable letters, buying just the letters you need to write it. You re-use letters you've bought for earlier words whenever possible. Given the words you want to write each day in order, output the letters you buy each day.
Example
Input: ['ONE', 'TWO', 'THREE', 'S... |
Your task is to generate a nonsense word that is reasonably pronounceable with the specified number of 'syllables'. Each time the program is run possibly results in a different nonsense word.
Pronounceability
A pronounceable word is made up of syllables, which are in turn made up of a vowel group that is possibly sandw... |
Codegolf challenge - mapping values in a multidimensional array
[
[0, 0, 0],
[0, 0, 0],
[0, 0, 0]
]
This 2D array is sick of being so false, and wants to find the truth about life, once and for all. Your task is to write a map function to act as a highway to all the values in this array.
An example implementatio... |
(Title with thanks to @ChasBrown)
Sandbox
The Background
This challenge is inspired by a question that I recently posted on Puzzling Stack Exchange. Please feel free to follow the link if you are interested in the original question. If not then I won't bore you with the details here.
The Facts
Every printable standard... |
This is taken from this question (with permission ofcourse). I'll quote:
Create a function which takes a string, and it should return true or
false based on whether the input consists of only a repeated character
sequence. The length of given string is always greater than 1 and the
character sequence must have a... |
John, a knight wants to kill a dragon to escape the castle! The dragon has A heads and B tails.
He knows, that:
if you cut off one tail, two new tails grow
if you cut off two tails, one new head grows
if you cut off one head, one new tail grows
if you cut off two heads, nothing grows
To defeat the dragon, John needs ... |
Input
Integers a1, a2, a3, b1, b2, b3 each in the range 1 to 20.
Output
True if a1^(a2^a3) > b1^(b2^b3) and False otherwise.
^ is exponentiation in this question.
Rules
This is code-golf. Your code must terminate correctly within 10 seconds for any valid input on a standard desktop PC.
You can output anything Truthy ... |
This question is tricky (and in particular harder than Which big number is bigger?), for those who like more challenging puzzles.
Input
Integers a1, a2, a3, a4, a5, b1, b2, b3, b4, b5 each in the range 1 to 10.
Output
True if a1^(a2^(a3^(a4^a5))) > b1^(b2^(b3^(b4^b5))) and False otherwise.
^ is exponentiation in this... |
A few hours earlier, I got this puzzle:
Suppose, you toss a coin n times, then what is the probability of getting m number of heads? ( where m belongs to the set of all prime numbers)
For instance, take n = 2, then
SS = { HH, HT, TH, TT }
So, output is 1/4 (for HH case)
Then, for n = 3,
SS = { HHH, HHT, HTH, THH, HTT... |
J. E. Maxfield proved following theorem (see DOI: 10.2307/2688966):
If \$A\$ is any positive integer having \$m\$ digits, there exists a positive integer \$N\$ such that the first \$m\$ digits of \$N!\$ constitute the integer \$A\$.
Challenge
Your challenge is given some \$A \geqslant 1\$ find a corresponding \$N \ge... |
Bob got kidnapped and is stuck in a maze. Your job is to help him find a way out. But since it is a very dark and scary maze, he can't see anything. He can only feel walls when he runs in to it, and knows when he has found the exit, but doesn't know anything more that.
Since he has to run your program by memory, it has... |
Brain-Flak is a stack-based esoteric language with eight commands:
() Evaluates to 1
<> Switch active stack; evaluates to 0
[] Evaluates to height of current stack
{} Pop current stack; evaluates to the popped number
(...) Execute block and push the result; evaluates as result
<...> Execute block; eva... |
Definitions:
A triangle is considered a right triangle if one of the inner angles is exactly 90 degrees.
A number is considered rational if it can be represented by a ratio of integers, i.e., p/q, where both p and q are integers.
A number n is a congruent number if there exists a right triangle of area n where all thr... |
Word changer is a game where you are trying to turn one word into another via single-character edits, with each step being its own word. For this challenge, edits may be replacements, insertions, or deletions. For example, WINNER → LOSER can be done with this route (there may be others):
WINNER
DINNER
DINER
DINE
LINE
L... |
The challenge is simply; output the following six 2D integer arrays:
[[ 1, 11, 21, 31, 41, 51],
[ 3, 13, 23, 33, 43, 53],
[ 5, 15, 25, 35, 45, 55],
[ 7, 17, 27, 37, 47, 57],
[ 9, 19, 29, 39, 49, 59]]
[[ 2, 11, 22, 31, 42, 51],
[ 3, 14, 23, 34, 43, 54],
[ 6, 15, 26, 35, 46, 55],
[ 7, 18, 27, 38, 47, 58],
[10, 1... |
Introduction:
Aaron is a young game developer. He recently joined the development team of a game where the players select their character from a predefined set, aka "heroes". Unfortunately, the names of the existing heroes are not evenly distributed throughout the alphabet. For example, there are 6 heroes that have a n... |
Given some positive integer \$n\$ generate all derangements of \$n\$ objects.
Details
A derangement is a permutation with no fixed point. (This means in every derangement number \$i\$ cannot be in the \$i\$-th entry).
The output should consist of derangements of the numbers \$(1,2,\ldots,n)\$ (or alternatively \$(0,1,... |
Upside-Down Pyramid Addition is the process of taking a list of numbers and consecutively adding them together until you reach one number.
When given the numbers 2, 1, 1 the following process occurs:
2 1 1
3 2
5
This ends in the number 5.
YOUR TASK
Given the right side of an Upside-Down Pyramid (Ascen... |
Given an infix expression, determine whether all constants are of the same type.
Operators will consist only of these dyadic operators: +-/*
Your program or function should take a valid expression string as input, and output a truthy value if the constants in the expression are of the same time, and a falsey value othe... |
Input
An integer n in the range 100 to 10^18 and an integer k in the range 1 to 18, inclusive.
The swap operation
A swap chooses two digits at different positions and exchanges their positions, as long as the swap does not result in a leading zero. For example if we start with the integer 12345 we can perform one swap ... |
Challenge
Given an IPv4 address in dotted-quad notation, and an IPv4 subnet in CIDR notation, determine if the address is in the subnet. Output a distinct and consistent value if it is in the subnet, and a separate distinct and consistent value if it is not in the subnet. The output values do not necessarily need to be... |
In the original Shantae game, there are transformation dances that you have to input in time using the D-Pad, A, and B. If you complete a predefined sequence while dancing, you will transform into the corresponding form (or teleport or heal). Your task is to output the corresponding effect when given an input. The catc... |
What is a Prime Square?
A Prime Square is a square where all four edges are different prime numbers.
But which ones?
And how do we construct them?
Here is an example of a 4x4 Prime Square
1009
0 0
3 0
1021
First we start from the upper left corner. We are working clockwise.
We pick the smallest prime number having 4... |
Given a list of words, output a square grid of characters, so that all the words can be read from the grid, by moving horizontally, vertically, or diagonally between characters, without reusing characters in the same word. The grid must be the smallest possible which allows all words to be read.
Example
B A D
R E T
E Y... |
So glad I found this cool site. Wanted to try sharing a coding challenge a friend gave me, an interview question. Usually it is written in java, but you can use whatever language you want, just have fun!
Challenge: write efficiently and securely a program that creates an array of n threads that communicate with each o... |
Input
A single integer \$1 \leq x \leq 10^{15}\$.
Output
The maximum number of distinct positive integers that have the product \$x\$.
Examples
Input: 1099511627776. Output: 9. One possible optimal list of factors is: (1, 2, 4, 8, 16, 32, 64, 128, 4096).
Input: 127381. Output 4. One possible optimal list of factors is... |
Some divisors of positive integers really hate each other and they don't like to share one or more common digits.
Those integers are called Hostile Divisor Numbers (HDN)
Examples
Number 9566 has 4 divisors: 1, 2, 4783 and 9566
(as you can see, no two of them share the same digit).
Thus, 9566 is a Hostile Divisor... |
The dihedral group \$D_4\$ is the symmetry group of the square, that is the moves that transform a square to itself via rotations and reflections. It consists of 8 elements: rotations by 0, 90, 180, and 270 degrees, and reflections across the horizontal, vertical, and two diagonal axes.
The images are all from this lo... |
Keeping this challenge short.
You are given 4 numbers: p1, p2, p3 and p4.
The magic sum of the numbers are defined as follows:
magic_sum = |p1 - p2| + |p2 - p3| + |p3 - p4| + |p4 - p1|
You are only allowed to change one of the above integer values (p1, p2, p3 or p4). You need to change the value such that the magic su... |
Challenge
Create a function takes in two 2-dimensional arrays of characters (or strings if the programming language does not have characters as a datatype) as inputs: a and b. If your language does not support these inputs, you may use any other standard one-byte variable.
Your task is to determine if b contains a. If ... |
Giving a challenge involving a Star Trek reference just after May the 4th may be frowned upon, but here goes.
You, Luke, Anakin, Palpatine, Yoda and Han Solo are involved in an insane tournament of Rock, Paper, Scissor, Lizard, Spock.
The catch here is that you are only allowed to use a fixed order of moves. If your or... |
In Emoji Math, a user created module for the video game Keep Talking And Nobody Explodes, numbers are written as strings of emoticons, where each emoticon represents a base 10 digit.
Below is the conversion table between digits and emoticons.
Digit | Emoticon
0 | :)
1 | =(
2 | (:
3 | )= ... |
This is a sequence question of the usual type, as applied to OEIS sequence A038666. That is, do either of the following:
Accept no or any input, and output A038666 until the heat death of the universe.
Accept a positive integer as input, and output the \$n\$th term of A038666 or its first \$n\$ terms. (If using \$0\$-... |
I'm a big fan of number theory. A big thing in number theory is modular arithmetic; the definition being \$a\equiv b\mod m\$ if and only if \$m\mid a-b\$. A fun thing to do is raising to powers: especially when the modulus is a prime number. In particular, it has been proven that if \$a\$ and \$m\$ are relatively prime... |
One day, when I was bored in maths class, I learned of a neat trick for solving the real cube root of a number!
Let's use the number \$79,507\$ as an example.
First, take digit in the one's place and compare it to this table:
\begin{array} {|r|r|}
\hline
\text{Extracted Digit} &\text{Resulting Digit} \\
\hline
\text{1}... |
Contest Finished! Read comments on blobs to view their score.
This KoTH is loosely inspired by Primer's Natural Selection Simulation. Your bot is a blob. In order to survive, you must eat pellets to regain energy, which is used to move. With extra energy, blobs can split into two.
Energy and Movement
Your blob starts o... |
A Munchausen Number in base \$b\$, also known as a Perfect digit-to-digit invariant or PDDI is a peculiar type of positive integer where the sum of its base-\$b\$ digits raised to themselves is equal to the number itself. They are named for the fictional Baron Munchausen, who apparently hoisted himself up via his own p... |
The Mel calendar is used in the fictional world of Kaldia. Your goal is to convert dates into the Mel calendar.
This calendar has 13 months of 28 days each, plus 1 or 2 extra days after the last month. A year that is divisible by 4 but not by 100, or divisible by 400 has 366 days, and other years have 365 (i.e. our lea... |
Per the fundamental theorem of arithmetic, for a given number \$n\$, it is possible to find it's prime factors, and they are unique. Let's imagine we talk only of \$n\$ that is non-prime (composite).
We can also find the factors of all the composite numbers smaller than \$n\$. For example if \$n\$ is 10, then it has f... |
You are given a square matrix of width \$\ge2\$, containing square numbers \$\ge1\$.
Your task is to make all square numbers 'explode' until all of them have disappeared. You must print or return the final matrix.
More specifically:
Look for the highest square \$x^2\$ in the matrix.
Look for its smallest adjacent neig... |
Background and Motivation:
IOC Country Codes are three letter abbreviations that are commonly used when broadcasting the Olympic Games. The last two letters of some codes overlap with the first two letters of other codes (RUS -> USA, JPN -> PNG), etc. Clearly, you can transform the first country code into the second by... |
Story
Have you seen this post from 9gag?
Maybe you got the feeling to make your own sentences. But then you realize that you could just golf a script in half an hour, and you will never have to deal time with that.
The submission
Your program will get an input string which it will return with added quotation marks as e... |
Sandbox
For the purposes of the current task, a cube of unit length is rendered in oblique projection with ASCII symbols as follows:
+-----+
/ /|
+-----+ |
| | +
| |/
+-----+
+ for the vertices.
- for the X edges. The unit length along X is represented by five - between two vertices.
| for the Y edges.... |
In a fictional document management system, input documents are structured with weighted headings. Lowest weighted headings are the most important.
This is a sample document:
H1 All About Birds
H2 Kinds of Birds
H3 The Finch
H3 The Swan
H2 Habitats
H3 Wetlands
From this document we would like to produce an outline usin... |
Thanks to @ComradeSparklePony for the title.
This challenge should be very simple. You are given three lists.
The first is a list of first names, in title case.
The second is a list of adjectives, in lower case.
The third is a list of nouns, in lower case.
Please randomly select a name, optional adjective, and noun, an... |
The challenge is to write a deterministic program (any language/OS) which takes no arguments or other input and behaves differently in a debugger from how it behaves when not being debugged.
For example, the program may output something when being debugged but not output anything when not being debugged. Or output some... |
Introduction
In number theory, we say a number is \$k\$-smooth when its prime factors are all at most \$k\$. For example, 2940 is 7-smooth because \$2940=2^2\cdot3\cdot5\cdot7^2\$.
Here, we define a \$k\$-smooth pair as two consecutive integers which both are \$k\$-smooth. An example of 7-smooth pair will be \$(4374,43... |
I am new to the sport of code golf. I am trying to generate a ladder of integers using the least number of unique characters in C++.
Let's say we are given an integer 4.
We will generate the following ladder:
1
1 2
1 2 3
1 2 3 4
In short, my program will read a positive integer from stdin and print this ladder to the o... |
Two ambassadors at a UN conference want to speak to each other, but unfortunately each one only speaks one language- and they're not the same language. Fortunately, they have access to several translators, who each understand and speak a few languages. Your task is to determine the shortest chain of translators (since ... |
Background
Ada is a programming language that is not exactly known for its terseness.
However, its array literal syntax can in theory allow for fairly terse array
specifications. Here is a simple EBNF description of the array literal
syntax (passable to bottlecaps.de:
array ::= positional_array | named_array
positional... |
Given a natural number \$n\$, return the \$n\$-th cuban prime.
Cuban Primes
A cuban prime is a prime number of the form
$$p = \frac{x^3-y^3}{x-y}$$
where \$y>0\$ and \$x = 1+y\$ or \$x = 2+y\$
Details
You may use 0 or 1 based indexing, whatever suits you best.
You can return the \$n\$-th prime given the index \$n\$ or... |
Introduction
In the strange world of integer numbers, divisors are like assets and
they use to call "rich" the numbers having more divisors than their reversal, while they call "poor" the ones having less divisors than their reversal.
For example, the number \$2401\$ has five divisors : \$1,7,49,343,2401\$, while its r... |
According to http://en.cppreference.com/w/cpp/language/integer_literal, integer literals consist of a decimal/hex/octal/binary literal and a optional integer suffix, that is obviously completely unnecessary, wastes precious bytes and is not used in this challenge.
A decimal literal is a non-zero decimal digit (1, 2, 3,... |
"Bracket" numerals are a type of 'numerals' I made up once, and thought would be a nice challenge here. Basically, you convert the input number into base 6, and then transliterate the 012345 respectively with ()[]{}†, so every 0 becomes (, every 1 becomes ), etc.
You don't have to use ()[]{} per se. As long as you spec... |
The gambler's fallacy is a cognitive bias where we mistakenly expect things that have occurred often to be less likely to occur in the future and things that have not occurred in a while to be more likely to happen soon. Your task is to implement a specific version of this.
Challenge Explanation
Write a function that r... |
Or, "Swap the first and last letters of each word"
Your challenge is to, given a string of alphabetical ASCII characters as well as one other character to use as a delimiter (to separate each word), swap the first and last letters of each word. If there is a one-character word, leave it alone.
The examples/testcases us... |
I have so many secrets and nowhere to keep them!
The goal is simple: write a program that lets you save a string and have it be protected by a password.
The program will take an alias, password and (optional) secret as parameters.
If this is the first time the program is called with a given alias, then it will store/re... |
This challenge is about building a chessboard in which the square size, instead of being constant across the board, follows a certain non-decreasing sequence, as described below.
The board is defined iteratively. A board of size \$n \times n\$ is enlarged to size \$(n+k)\times(n+k)\$ by extending it down and to the rig... |
Given an ASCII art hexagon as input, output one whose sides are all one unit longer.
_____
____ / \
/ \ / \
/ \ / \
\ \ => \ \
\ / \ /
\____/ \ /
\_____/
... |
Given a string, you've to split it into groups of three characters (by padding _ at the end).
Related, but still it's different.
Sample I/O:
'abcde' -> 'abc', 'de_'
'1234' -> '123', '4__'
'' -> [] or falsey value
'Three spree!' -> 'Thr', 'ee ', 'spr', 'ee!'
6 MB string
This is a code-golf, so fewest bytes wil... |
Your task is to generate a graph with 54 vertices, each corresponds to a facet on a Rubik's cube. There is an edge between two vertices iff the corresponding facets share a side.
Rules
You may choose to output an adjacency list, adjacency matrix, edge list, or any reasonable format to represent a graph in an algorithm... |
In this challenge, your bot has landed on an island with the stereotypical knights and knaves. Knights always tell the truth, and knaves always lie. The objective is to find the correct 32 digit hexadecimal string before anyone else, by asking knights and knaves and trying to trick other bots into giving you answers or... |
Challenge
Given a base \$1 < b < 10\$ and an index \$t \ge 1\$, output term \$x_t\$, defined as follows:
\$x_1 = 11_{10}\$
\$x_{i+1}\$ is obtained by converting \$x_i\$ to base \$b\$ and then reinterpreting its digits in base \$10\$
Output should be in base \$10\$
A walk through for base 5, term 5 would be:
\$x_1 = ... |
This challenge is to produce the shortest code for the constant \$\pi^{1/\pi}\$. Your code must output the first \$n\$ consecutive digits of \$\pi^{1/\pi}\$, where \$n\$ is given in the input. Alternatively, your program may accept no input, and output digits indefinitely
This is code golf, so the shortest submission ... |
Thanks, Uncle (the story)
My slightly mad uncle recently left for the space colonies, and passed his pallet goods business to me. The rectangular warehouse is full of pallets of goods except for the one square by the door, and I've just received the first list of pallets ordered by customers to be sent out today.
Fortu... |
The gravitational force is a force that attracts any two objects with mass. In this challenge our objects will be Numbers and their mass will be their value. To do so, we don't care about the strength of the force but the direction of it.
Imagine this set of numbers
[1 6 9 4 6 9 7 6 4 4 9 8 7]
Each of them creates a ... |
We all know the classic dad joke that goes something like this:
Somebody says a sentence to describe their self (e.g. I'm tired or I'm confused).
A dad-joke enthusiast comes along and replies Hi <adjective>, I'm Dad!, because introductions follow the same format (I'm Peter follows the same format as I'm hungry).
Yo... |
It was a dark and stormy night. Detective Havel and Detective Hakimi arrived at the scene of the crime.
Other than the detectives, there were 10 people present. They asked the first person, "out of the 9 other people here, how many had you already met before tonight?" The person answered "5". They asked the same questi... |
Warning: This is a bit lengthy
I have decided to build my own random function I call it "Random Cake"
This function should get an integer value between 0 and 99999
Ingredients
1 x DateTime function
1 x Sin : Radians
1 x Absolute Value
1 x π
a dash of multiplication, division and addition
Here is the recipe
Reci... |
In your grandparents' day, dialing a phone number was done with a rotary dial like this:
To dial each digit, put your finger in the corresponding hole, pull it over to the finger stop, and release it. A mechanism will cause the dial to spin back to its resting position, and the phone will disconnect and reconnect a c... |
Given a list of at least two words (made only of lowercase letters), construct and display an ASCII ladder of the words by alternating the direction of writing first to the right, then to the left, relatively to the initial direction from left to right.
When you finish writing a word, change the direction and only then... |
Introduction
In many programming languages, within syntax exceptions, it is often pointed out to the programmer exactly which character or line is the culprit. This challenge will be a bit of a modification of that - specifically, using an arrow to point out any specific character of an input string.
The challenge
Your... |
Introduction
It is somewhat like DVORAK Keyboard layout , but MUCH harder.
Let's talk about the Korean keyboard first. As you can see in Wikipedia, there is a Kor/Eng key to change between Korean and English key sets.
Koreans sometime type wrong : they attempt to write in Korean on a qwerty keyboard or in English on a ... |
Suppose there are 5 positive integers in an array or list as 14, 12, 23, 45, 39.
14 and 12 cannot be taken in the subset as 1 is common in both. Similarly {12, 23}, {23, 39}, {14, 45} cannot be included in the same subset.
So the subset which forms the maximum sum is {12, 45, 39}. The maximum sum such formed is 96.
the... |
I use "sentence" here loosely to mean "any sequence of words separated by spaces" and "words" to mean "sequences of alphanumeric (hexatrigesimal) characters unseparated by spaces".
Conversion is from base-36 (0123456789abcdefg...) or (0123456789ABCDEFG...)
Conversion to base-16 (0123456789abcdef) or (0123456789ABCDEF)... |
Your task is to modify the original Plan 9 cat tool for UNIX, in order to make it a fully turing complete language interpreter. You may make use of ANSI escape codes and the backspace character (\x08) to aid in this.
You must submit:
A modified version of the Plan 9 cat tool
A hexdump of the turing machine that can be... |
It is Restricted Integer Partitions, but with maximum number.
Question
Three positive integers are given. First number is number to divide, second number is length of partition, and third number is maximum number. First number is always largest, and bigger than other two.
For example, 5, 2, 3. Then, make partition of 5... |
Context:
Gynvael Coldwind, a famous security researcher, published a contest in his blog post (that is now complete). The goal was similar to the one described here, but with certain restrictions depending on which of the three allowed programming languages was chosen. I found the exercise fun and wanted to extend the ... |
Introduction:
In Dutch, the words leading and suffering, being 'leiden' and 'lijden' respectively, are pronounced the same way. One is written with a "short ei", and one with a "long ij", as we Dutchman would say, but both 'ei' and 'ij' are pronounced [ɛi].
Challenge:
Given a list of numbers, determine which (if any) a... |
It is ancient knowledge that every non-negative integer can be rewritten as the sum of four squared integers. For example the number 1 can be expressed as \$0^2+0^2+0^2+1^2\$. Or, in general, for any non-negative integer \$n\$, there exist integers \$a,b,c,d\$ such that
$$n = a^2+b^2+c^2+d^2$$
Joseph-Louis Lagrange pro... |
Challenge:
Input:
A sorted list of positive integers.
Output:
The amount of integers which are still at the exact same index, after rotating the digits in each integer its index amount of times towards the left and sorting the modified list again.
Example:
Input: [8,49,73,102,259,762,2782,3383,9217,37846,89487,7471788]... |
Your task is to, given two positive integers, \$x\$ and \$n\$, return the first \$x\$ numbers in the incremental ranges sequence.
The incremental range sequence first generates a range from one to \$n\$ inclusive. For example, if \$n\$ was \$3\$, it would generate the list \$[1,2,3]\$. It then repeatedly appends the la... |
Challenge
I'm under attack by the larcenous Midnight Crew and I need to summon the Catenative Doomsday Dice Cascader in order to defend myself. Since I'm low on space, I need the code to be as short as possible.
The algorithm for the Catenative Doomsday Dice Cascader is as follows:
First, the six sided die in the Prime... |
I'm stuck on a problem involving the Gale-Ryser Theorem. The problem's input gives me the row-wise sum of an hv-convex binary matrix(n*m).
e.g. I get {4,3,2,2,1} in the input. It's the row wise sum of the following matrix:
1 1 1 1
1 1 1 0
1 1 0 0
1 1 0 0
1 0 0 0
To solve the problem, I have to fin... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.