Questions tagged [subsequence]
Challenges pertaining to a sequence within a larger sequence
119
questions
12
votes
5
answers
439
views
Maximal linear sublists
In this challenge you will write code to take a list of positive integers and output all maximal linear sublists.
A sublist is is a list which can be created by deleting values from the the input ...
9
votes
11
answers
745
views
Otteretto Classic game scoring method
Brief description of the game
In the game Otteretto Classic (which you can test directly in your browser; try it!) the player has to form palindromic sequences using adjacent cells on a square grid. ...
-3
votes
7
answers
1k
views
Straight pen strokes for Prime Numbers
Challenge
You are supposed to output the series I recently designed which goes as follows which are pen stroke counts of ascending prime numbers:
...
7
votes
6
answers
393
views
Bumping Series Implementation
I have a follow-up question here from my previous question on Math SE. I am lazy enough to explain the content again, so I have used a paraphraser to explain it below:
I was considering arbitrary ...
8
votes
18
answers
702
views
Find the largest sum of any contiguous subarray of the array [duplicate]
Let's say you are given an integer array. Create a function to determine the largest sum of any array's adjacent subarrays. For instance, the contiguous subarray with the largest sum is ...
15
votes
23
answers
2k
views
Find the first run of numbers summing to n
Given as input a positive nonzero integer n >= 10 and a sequence of digits 0-9 (which may be taken as a string or a list), ...
14
votes
12
answers
1k
views
Count the shared substrings with 2 programs
Write 2 programs in the same language which count the number of shared subsequences of consecutive elements from 2 given sequences.
For example, given ...
17
votes
9
answers
2k
views
Longest alternating subsequence
inspired by Longest Increasing Substring
Task
Given a list of non-negative integers, output the length of its longest alternating subsequence.
An alternating sequence is a sequence of numbers which ...
29
votes
34
answers
3k
views
Backronymiser឵឵
Background
A backronym is an acronym that was formed from an existing word. For example, spam is actually named after the canned meat product as used in the Monty Python sketch, but can be ...
15
votes
11
answers
2k
views
Make the list Fibonacci-like
Related, but not dupe.
Challenge
A list of integers \$a_1, a_2, a_3, \dots, a_n\$ (\$ n ≥ 1 \$) is Fibonacci-like if \$a_i = a_{i-1} + a_{i-2}\$ for every \$i > 2\$. Note that every list that ...
11
votes
7
answers
671
views
Shortest restricted superstring
Given two sets of strings, \$ D \$ and \$ R \$, find the shortest string which contains every string in \$ D \$, but contains none of the strings in \$ R \$.
There are almost always multiple possible ...
19
votes
8
answers
2k
views
Optimally break a string into words
Given a string, like potatocarrot, break it into the smallest number of substrings possible. These substrings can consist either be a single character, or one of a ...
31
votes
35
answers
3k
views
Is it a fibonacci-like sequence?
The Fibonacci Sequence is a sequence of positive integers where the first two elements are 1 and the rest are the sum of the previous two. It begins \$1, 1, 2, 3, 5, 8, 13\$ and continues forever.
But ...
12
votes
8
answers
846
views
All sequences as substrings
Make a program that outputs a sequence of integers so that every finite sequence of positive integers is a substring (continuous subsequence) of the output.
For example, the following sequence ...
23
votes
25
answers
1k
views
How many laps around the permutation?
Your input is an array of numbers: a permutation of \$\{1, 2 \dots n\}\$ for some integer \$n \geq 2\$.
How many times must you repeat this list before you can "pick out" the numbers \$[1, 2 ...