Skip to main content

Questions tagged [subsequence]

A subsequence is a sequence obtained by deleting some elements and retaining the relative order of the remaining elements. It is a generalization of substring which contains only consecutive elements of the original sequence.

subsequence
1 vote
1 answer
86 views

Determine which elements of sequence A can be used to create given sequence B in linear time

Let's say we have sequence A and subsequence of A, called B. I need to determine which elements of sequence A could be potentially used to construct subsequence B. For example, assume A = [1, 3, 2, 1, ...
Szyszka947's user avatar
3 votes
3 answers
158 views

Longest Repeating Subsequence: Edge Cases

Problem While solving the Longest Repeating Subsequence problem using bottom-up dynamic programming, I started running into an edge case whenever a letter was repeated an odd number of times. The goal ...
William Edwardson's user avatar
1 vote
2 answers
29 views

Longest sequence count and sequence to be returned

We need to print the longest sequence of nos. Input = [2,3,4,5,8,0] Output= 3,[2,3,4,5] Input=[2,3,4,5,8,0,10,9,8,7,6,5] Output= 5,[10,9,8,9,6,5] Below is the code that I have written, can someone ...
rj_47's user avatar
  • 11
1 vote
1 answer
35 views

Setting a minimum length for subsequences?

I'm using TraMineR to analyze the transitions between states over a 30 minute trial. There are 10 states, and then missing values, for the entire 108,000 frames. When I get the subsequences, it ...
Becca Trapp's user avatar
1 vote
1 answer
132 views

Check if a string has a palindrome subsequence of length k

The string S consists of lowercase English letters. I want to know whether this string contains a palindrome subsequence of length exactly k or not. I want a dynamic programming algorithm that runs ...
Sheldoor's user avatar
0 votes
0 answers
38 views

Time Complexity of the Iterative Version of the Subsequence Question

What will be the time complexity of the Code below, as my teacher said the time complexity will be O(N2^N). My question, as per my understanding of how T.C(which might be very wrong, so please don't ...
Karan Badhwar's user avatar
0 votes
2 answers
197 views

Increasing Tripplet Subsequence

I was attempting the Increasing Triplet Subsequence problem on leetcode.com I started off with a brute force approach but it ran into time out issues but passing almost all testcases. The following is ...
Spindoctor's user avatar
1 vote
1 answer
211 views

Find occurrences of subsequence in a binary string (non-necessarily-contiguous)

Given a binary string with 0 and 1. I want to know number of occurrences of subsequences 01 and 10 in the given input String. Subsequences are not necessarily contiguous. For example: input : "...
Learner's user avatar
  • 21.2k
0 votes
0 answers
48 views

Subsequence and subset of the array

I have a doubt between the subsequence and subset of the array. Suppose I have an array: nums = [1,2,3] output = [[],[1],[2],[1,2],[3],[1,3],[2,3],[1,2,3]] Whether output contains subsequence or ...
xyz xyz's user avatar
  • 21
0 votes
2 answers
100 views

NumPy: find indices of strictly increasing subsequence within an array

I am NOT looking to find the largest increasing subsequence. I have a NumPy array similar to the following: [0, 1, 5, 2, 4, 8, 8, 6, 10] I need to find the indices of the elements that form a ...
kpjoshi's user avatar
  • 119
3 votes
2 answers
1k views

Number of subsequences of length 3 or more, such that the sum of its "middle" is equal to the values of its "endpoints"

Given an array of integers (length N), return the count of subsequences of length at least 3 (from 3 to N) such that the following conditions hold: the value of the first element of the subsequence ...
Peter Bilko's user avatar
0 votes
0 answers
25 views

Why am I getting '[...]' as a subsequence of my input string? [duplicate]

I am trying to recursively obtain all subsequences for an input string. While I am getting the said subsequences, another element keeps getting added as well. I cannot figure out what is producing ...
Khushi Saxena's user avatar
0 votes
1 answer
143 views

Combination Sum code giving me incorrect answer

Problem (Combination Sum): Given an array of distinct integers candidates and a target integer target, return a list of all unique combinations of candidates where the chosen numbers sum to target. ...
stardust_'s user avatar
0 votes
1 answer
252 views

Segmentation with piecewise linear regression

I am willing to segment a sequence into n subsequences (n known) where my points in each subsequence should be similar in a way that a piecewise linear function could fit the points (minimize the ...
Mathieu's user avatar
  • 13
0 votes
3 answers
44 views

How to copy all data in a table into the same table, but only changing one column to have subsequent numbers

I have to do the following and can't figure out how to do it all correctly: I have a table test Test1 Test2 1 ABC 2 DEF I want to duplicate this, and have the test1 column have subsequent ...
Lvh's user avatar
  • 25

15 30 50 per page
1
2 3 4 5
21