Questions pertaining to a sequence within a larger sequence

learn more… | top users | synonyms

35
votes
13answers
5k views

Universal Spooky Meme Translator

Introduction Turns out, aliens love memes just as much as we do. Every alien race we've encountered so far has their own version of 2spooky4me (see the following question) and equivalent, though, ...
28
votes
25answers
1k views

Subsequence Substitution

Most languages come with a built-in to search a string for all occurrences of a given substring and replace those with another. I don't know of any language that generalises this concept to (not ...
27
votes
24answers
1k views

Decompose binary into alternating subsequences

This was inspired by Problem 13 - Non-Repeating Binary of HP CodeWars' recent competition. Let's take a random decimal number, say 727429805944311 and look at its binary representation: ...
20
votes
5answers
802 views

Is this a submatrix?

This is the 2-dimensional generalisation of this challenge. For our purposes, one matrix (or 2D array) A is considered a submatrix of another matrix B, if A can be obtained by completely removing a ...
16
votes
11answers
726 views

Sum of Binary Substrings

This challenge is simple, given a decimal number, convert to binary, and calculate the sum of the sub-strings of the binary number, whose length is shorter than the original number. Here is an ...
10
votes
3answers
151 views

Sliding Capitals

The Background Imagine the English alphabet written out in a row in capital letters -- ABCDEFGHIJKLMNOPQRSTUVWXYZ. Suppose we have a special variable-width lens such that, when placed over the row, ...
15
votes
1answer
359 views

Same-color arithmetic progressions

Van der Waerden's theorem says that For any given positive integers r and k, there is some number N such that if the integers {1, 2, ..., N} are colored, each with one of r different colors, ...
13
votes
3answers
298 views

Reverse-Engineer the N-Bonacci sequence[s]

EDIT: I will be accepting an answer Monday, 2/15/2016. May the bytes be ever in your favor! In his "Print the N-Bonacci Sequence" challenge, @DJMcGoathem describes the N-bonacci sequences, wherein ...
15
votes
1answer
246 views

Know a sequence by its subsequences

Introduction Suppose you and your friend are playing a game. Your friend thinks of some particular sequence of n bits, and your task is to deduce the sequence by asking them questions. However, the ...
20
votes
13answers
880 views

Remove digits, retaining greater number

Introduction This challenge consists in finding the greatest number removing y digits from the original number n which has x digits. Assuming y=2 n=5263 x=4, the possible numbers removing y=2 digits ...
22
votes
5answers
464 views

Fractal Smoke Sequence

Introduction A229037 has a quite intriguing plot (at least for the first few terms): There is the conjecture, that it might indeed have some kind of fractal property. How is this sequence ...
18
votes
1answer
194 views

Maximal Substring Construction

In this challenge, you are passed two things: A string length, N A list of strings, L, each with an assigned point value. Any string that is not passed in has a point value of 0 You need to ...
14
votes
2answers
150 views

Partition into increasing subsequences

Specification This challenge is simple to state: your input is a non-empty array of nonnegative integers, and your task is to partition it into as few increasing subsequences as possible. More ...
19
votes
1answer
197 views

One goes up, the other comes down

Introduction In this challenge, your task is to decide whether a given sequence of numbers can be separated into two subsequences, one of which is increasing, and the other decreasing. As an example, ...
22
votes
3answers
449 views

Four steps to the left: vipers. Four steps to the right: a cliff. Don't die!

Introduction Suppose for a moment that the vipers and cliff are only two steps away, instead of three. o --- Hsss! | ';;' ___ /_\ ___ _ | You ...
8
votes
3answers
274 views

Drop of Chaos (Constructing a Minimally Aperiodic Sequence)

The idea here is to produce an almost repeating pattern. That is, the sequence being constructed changes at the last moment to avoid a repetition of some subsequence. Subsequences of the type AA and ...
9
votes
7answers
492 views

Heaviest increasing subsequence

A subsequence is a sequence that can be derived from another sequence by deleting some elements without changing the order of the remaining elements. A strictly increasing subsequence is a subsequence ...
11
votes
2answers
546 views

Fastest Longest Common Subsequence Finder

Your task is to solve the Longest Common Subsequence problem for n strings of length 1000. A valid solution to the LCS problem for two or more strings S1, … Sn is any string T of maximal ...
11
votes
5answers
948 views

Shortest Longest Common Subsequence Code

Your task to to solve the SLCSC problem, which consists in finding the shortest possible code to solve the Longest Common Subsequence problem. A valid solution to the LCS problem for two or more ...
32
votes
33answers
3k views

Stretching Words

Write a program or function that duplicates letters in a word, so that all the duplicated letters arranged from left to right in the word would form the input array. For example: input: chameleon, ...
11
votes
3answers
245 views

Wrap-Around Subsequences

Introduction In this challenge, your task is to find generalized subsequences of strings. The subsequences are not necessarily contiguous, and they can also "wrap around" the string, going past its ...
10
votes
1answer
272 views

Generate a Davenport-Schinzel Sequence

Background A Davenport-Schinzel sequence has two positive integer parameters d and n. We will denote the set of all Davenport-Schinzel sequences for given parameters by DS(d,n). Consider all ...
15
votes
1answer
1k views

Fix unbalanced brackets [duplicate]

Consider the alphabet A ="()[]{}<>". Think of the characters in the alphabet as opening and closing brackets of 4 different types. Let's say that a string over the alphabet A is balanced if it ...
7
votes
9answers
337 views

Group adjacent values

The task is to group adjacent values from collection and output it as a new aggregated collection. Consider we have following input: Sequence Number Value ======== ===== 1 9 2 ...
3
votes
11answers
518 views

The group of sequential positive numbers with the highest sum?

Given the following list of numbers, find the group of sequential positive numbers with the highest sum. Example input: 12 2 35 -1 20 9 76 5 4 -3 4 -5 19 80 32 -1 Example output: 131 The most ...
10
votes
10answers
941 views

Find largest sum of subsequence

Given a sequence of integers find the largest sum of a subsequence (integers on consecutive positions) of the sequence. The subsequence can be empty (in which case the sum is 0). Input is read from ...
14
votes
9answers
3k views

Shortest, lexicographically smallest generating string

A string x generates a string y if y is a substring of an infinite repeat of x. For example abc generates bcabcab. Write a program to find the shortest, lexicographically smallest string that will ...
3
votes
3answers
501 views

Finding “sub-palindromes” 2: subsequences.

The same task as Finding "sub-palindromes" but instead of finding substrings you must find subsequences that are not substrings. eg1: input: "12131331" output: "11", "33", "111", "121", "131", ...