Questions tagged [subsequence]

Challenges pertaining to a sequence within a larger sequence

Filter by
Sorted by
Tagged with
0
votes
1answer
119 views

CSV cleanup: remove all in col after ( [closed]

Problem Given a file with: ...
25
votes
12answers
1k views

Find the original string, without the repetition without the repetition in the middle

Sometimes it happens that while typing a sentence, I am distracted and I end up typing the same couple of words twice couple of words twice in succession. To make sure make sure other people are not ...
21
votes
10answers
1k views

How many Blackjack sequences in that list?

Your task is to find how many distinct Blackjack sequences can be found in an ordered list of 12 cards. A Blackjack sequence is defined as a sequence of consecutive cards whose sum of points is ...
45
votes
44answers
5k views

Bit run rundown

Given an integer n > 0, output the length of the longest contiguous sequence of 0 or 1 in ...
35
votes
10answers
2k views

Scroll Word's font size selector

Word's A▲ and ᴀ▼ buttons change the font size according to these rules: The starting font size is 11. If ᴀ▼ is pressed when the font size is 1, the size stays 1. The font size changes with 1 point in ...
25
votes
7answers
722 views

Uniquely removable subsequences

Introduction Consider a sequence of integers and one of its subsequences, say A = [4 2 2 4 4 6 5] and B = [2 4 5]. We want to remove the elements of B from A in order, and there are several ways of ...
3
votes
1answer
1k views

Add the Fibonnaci Sequence to the Lucas Sequence [duplicate]

Background of Lucas Numbers The French mathematician, Edouard Lucas (1842-1891), who gave the name to the Fibonacci Numbers, found a similar series occurs often when he was investigating Fibonacci ...
8
votes
7answers
360 views

Get a word's individuality!

I love /usr/share/dict/words; it's so handy! I use it for all my programs, whenever I can! You're going to take advantage of this ever so useful file to use, by ...
24
votes
9answers
675 views

Smallest number of contiguous monotonic subsequences

A monotonic subsequence is a sequence of numbers \$a_1, a_2, ..., a_n\$ such that $$a_1 \le a_2 \le ... \le a_n \\ \text{or} \\ a_1 \ge a_2 \ge ... \ge a_n$$ ...
28
votes
20answers
2k views

Pairable strings

A string is pairable if it can be split into subtrings, each of which is a string repeated twice consecutively. For example, aabaaababbbaba is pairable as: ...
1
vote
1answer
501 views

Write a self-aware program [duplicate]

A standard (but disputed) test of self-awareness is the mirror test: An animal is considered self aware if it can recognize itself in the mirror. Your task is to write a program that is self-aware ...
20
votes
16answers
4k views

Find the odd one out in a sequence

The Challenge: Consider the function F(N) = 2^N + 1 where N is a positive integer less than ...
20
votes
13answers
2k views

Is it a wordinian?

What is the shortest way to see if an input is a wordinian using any programming language? A wordinian is a word that contains words of length 1 to the original word's length. For example, bin ...
14
votes
13answers
1k views

Generate Linus Sequence

Definition From the description on OEIS A006345: To find a(n), consider either a 1 or a 2...
9
votes
8answers
663 views

Missing Integer Sequence Detection -- Filesystem

The challenge is to detect missing integer sequences of files or directories. You have a directory filled with files/directories that are named as integers. The files/directories are generated from ...
20
votes
25answers
1k views

Reverse odd runs

Inspiration. Task Reverse runs of odd numbers in a given list of 2 to 215 non-negative integers. Examples 0 1 → 0 1 ...
42
votes
18answers
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 ...
30
votes
32answers
2k 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 ...
30
votes
30answers
2k 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 ...
20
votes
7answers
1k 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
971 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 example:...
16
votes
8answers
460 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 ...
15
votes
1answer
485 views

Same-color arithmetic progressions

Van der Waerden's theorem says that For any given positive integers r and k, there is some number ...
17
votes
5answers
590 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 ...
18
votes
1answer
388 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 ...
22
votes
14answers
3k 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 ...
33
votes
9answers
1k 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
380 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 ...
15
votes
2answers
601 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 ...
20
votes
3answers
452 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, ...
27
votes
3answers
722 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. ...
9
votes
3answers
376 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
921 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
2k 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 length such ...
11
votes
5answers
2k 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 ...
34
votes
38answers
5k 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: ...
11
votes
3answers
295 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 ...
11
votes
1answer
407 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-...
33
votes
24answers
4k views

Bring out the inner llama of a sentence

Your objective is to take input like Pie is good. I just ate a bunch of pies early this morning. Actually, it was closer to the afternoon. Mornings are good. ...
15
votes
1answer
2k 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 ...
7
votes
9answers
464 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 ...
2
votes
17answers
726 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 ...
11
votes
10answers
1k 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 ...
17
votes
9answers
7k views

Shortest, lexicographically smallest generating string

A string x generates a string y if y is a substring of an infinite repeat of ...
2
votes
3answers
989 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: ...
24
votes
35answers
2k views

Finding "sub-palindromes".

The shortest code that finds all unique "sub-palindromes" of a string, that is: any substring with length > 1 that is a palindrome. eg.1 ...

1
2