Skip to main content
Filter by
Sorted by
Tagged with
1 vote
1 answer
42 views

I've been working on a JavaScript function to calculate the length of the longest substring without repeating characters. I encountered a couple of issues that I'm hoping to get some clarity on: Using ...
Sanjay sharma's user avatar
2 votes
2 answers
54 views

tables I'm struggling to achieve the following. I have a table of postal codes that includes full and partial postal codes. It will have other columns also. In another table, I have locations, all ...
user26863736's user avatar
1 vote
2 answers
83 views

I have a very long list of domains (for example: blockme.com, do.remove-me.com.. etc) millions of them. I would like to use this list to create a list of regular expressions to cover as much as ...
user avatar
0 votes
0 answers
91 views

So I have a pandas DataFrame where there are over 50000 rows. In one column, there is a list of strings that has no spaces, and is converted to lowercase, and there are multiple junk characters. The ...
Saadevni's user avatar
0 votes
1 answer
120 views

`Here are the code and the error. I am not sure what to do for the declare any desired classes. Traceback (most recent call last): File "/home/runner/local/submission/main.py", line 149, in ...
Haseeb Khan's user avatar
2 votes
1 answer
108 views

let lcs = (s, t) => { let dp = Array.from({ length: s.length + 1 }, () => Array.from({ length: t.length + 1 }, () => 0)); let maxLen = 0, endIndexS = 0, endIndexT = 0; ...
1641_Shourav Chy's user avatar
1 vote
0 answers
108 views

I have been working on an exercise that gives two string s and t, find the longest common substring by outputting 3 integers: its starting position in s, its starting position in t (all 0-based), and ...
Andy Nguyen's user avatar
0 votes
2 answers
111 views

How to get count of max consecutive substring ab in given string abhwasababababuqabab Input: abhwasababababuqabab Output: 4 how? We have 4 consecutive ab at middle from 6th index to 13th index. At ...
ddray31's user avatar
1 vote
1 answer
81 views

I have a function that finds and prints the longest common chain between two DNA chains. However I want to add some checks so my program can ignore characters that are not bases ('A', 'T', 'C', 'G') ...
ms complaints's user avatar
1 vote
2 answers
322 views

Assume we have been provided with a string. s="This is my statement" We have to get sentence as an output and this needs to be solved using list comprehension concept. I have tried the code ...
Varun's user avatar
  • 23
-1 votes
2 answers
64 views

im asked to build a function that finds the longest substring with no repeating characters in a given string. this is gonna be a 2 in 1 question bc i want to now if my approach is correct and if "...
user1188938's user avatar
0 votes
3 answers
118 views

I am new to C and still learning(currently doing some "LeetCode" challenges). I wrote a function that should return the longest common prefix in an array of strings. I tested with a couple ...
OldCrow's user avatar
  • 37
1 vote
2 answers
948 views

I am trying to solve this problem on LeetCode (https://leetcode.com/problems/longest-substring-without-repeating-characters/) I got a code but i don't understand what's the problem with it. def ...
AT Hill's user avatar
  • 21
0 votes
1 answer
61 views

i want to write a program that first takes the amount of n and then gets n strings (example: if n = 4 it gets 4 strings ) and then checks all the strings and finds the longest substring that contains ...
Phantom's user avatar
  • 83
0 votes
0 answers
84 views

Longest common substring is a well-known problem. I'm interested in identifying common substrings in a set of strings that is growing over time. Use case: suppose I'm emitting log messages inside a ...
sp1ff's user avatar
  • 117
-1 votes
1 answer
37 views

input has list of nos output has all the possible pattern occurring and the position where the pattern break input [1,2,3,1,2,3,1,2,3,4,1,2,3,10,5,6,4,5,6,8,4,5,6,12,2,3] output [1,2,3]: 10th ...
KS HARSHA's user avatar
1 vote
3 answers
222 views

I'm doing this exercise: Write a Python program that gives two options to the user to either find the shortest string in a string list or the lowest element of an integer list. The program should ...
cheater flex's user avatar
2 votes
2 answers
418 views

I am very new to python and am really struggling with this problem. I have a csv file with different columns, labeled "height" "weight" "full_name" etc. I'm trying to ...
Emppy's user avatar
  • 25
1 vote
0 answers
89 views

Write with OCaml Longest Common Sottosequence (Deep Search) Consider a finite set S of strings and an integer K. Determine, if it exists, a string x of length greater than or equal to K subsequence of ...
Belhadj Terbagou's user avatar
1 vote
1 answer
775 views

My question is how to find the longest common substring from two sentences. For example: sequence 1 = "there were a dozen eggs in the basket" sentence 2 = "mike ate a dozen eggs for ...
mk6man's user avatar
  • 43
0 votes
0 answers
114 views

i'm trying to obtain the longest common substring from two strings and have coded a trie, but im not too sure how to obtain the longest common substring based on this trie. Could someone please help, ...
marvel's user avatar
  • 1
0 votes
1 answer
125 views

I've tried to implement LCS in python using the following code, where am I going wrong ? def lcs(s1,s2): if len(s1) == 0 or len(s2) == 0: return "" n = len(s1) - 1 m ...
v1998199904's user avatar
1 vote
1 answer
452 views

Problem: Longest Substring Without Repeating Characters. I have this solution. But I do not have much of theoretical knowledge about DSA. Trying to understand which algorithm it comes under and will ...
shantanu ghosh's user avatar
1 vote
0 answers
197 views

I have a fairly standard moving window function to find longest substring. var lengthOfLongestSubstring = function (s) { let currentString = []; let longestStringLength = 0; let ...
Lewis's user avatar
  • 185
1 vote
1 answer
61 views

For every string in a df column, I need the character at which this string becomes unique, that is, its uniqueness point (UP). For illustration, here is a toy dataframe: import pandas as pd import ...
hyhno01's user avatar
  • 177
1 vote
0 answers
311 views

I was able to think of a recursive solution for the problem "Longest Common Substring" but when I try to memoize it, it doesn't seem to work as I expected it to, and throws a wrong answer. ...
Roy0Anonymous's user avatar
-1 votes
3 answers
2k views

I have a list of words: list1 = ['technology','technician','technical','technicality'] I want to check which phrase is repeated in each of the word. In this case, it is 'tech'. I have tried ...
Abhishek Pagare's user avatar
1 vote
0 answers
14 views

How to make XSLT substring-before second comma separate for example the separator is ',' ex : Aban, aban, 22, 33 so the result should be Aban, aban and following numbers in other elements.
Joseph Marian's user avatar
1 vote
1 answer
1k views

I know the implementation of the edit distance algorithm. By dynamic programming, we first fill the first column and first row and then the entries immediately right and below of the filled entries by ...
Lerner Zhang's user avatar
  • 7,278
2 votes
1 answer
1k views

Let me start with an example. Consider the following list in python cities = [ 'New york' 'San francisco', 'California', 'Las vegas', 'Chicago', 'Miami' ] I also have ...
Ruchit's user avatar
  • 356
1 vote
1 answer
198 views

I am getting confused tracing the following recursive approach to find the longest common substring. The last two lines are where my confusion is. Specifically how is the count variable getting the ...
Joe Brandon's user avatar
0 votes
1 answer
725 views

Iam trying to print all possible longest common subsequence using below code 1-Firstly i found LCS length dp matrix and trying using recursion to produce all possible outputs. #####################...
Pranav M's user avatar
0 votes
2 answers
2k views

I have been trying to get below result out of this Program but for some reason it is not giving the required output. Required Results: Input1 : bbaasssrppoccbaaacbaba Output1 : ['bbaa','...
Shivam Yadav's user avatar
8 votes
2 answers
2k views

Problem: Given a String S of N characters (N <= 200 000), find the length of the longest substring that appears at least twice (the substrings can overlap). My solution: Here's what i've tried: int ...
unglinh279's user avatar
1 vote
4 answers
855 views

Let me preface with I AM A NEWBIE so take it easy on me please lol. I need help writing a function that takes an array of words and returns an object with the letter and the length of the longest ...
user16722579's user avatar
0 votes
2 answers
395 views

I built a custom function two compare two url's to get the longest common subsequence (lcs). def lcs_dynamic(url1, url2): maths: compare url1 with url2 return lcs I have a series s1 and a ...
TGee's user avatar
  • 41
0 votes
0 answers
136 views

I am trying to get the longest common substring recursively but for some reason my code is not working. def lcs(s, t): if not s or not t: return '' if s[0] is t[0]: return s[0]...
Guilherme's user avatar
0 votes
0 answers
117 views

I am trying to generate the longest repeating subsequence but the output appears to be incorrect for a few cases. Below is the code block I am using def LRSLength(X, m, n): # return if the end of ...
Mehul Gupta's user avatar
  • 1,939
1 vote
2 answers
86 views

Hello I have a dataframe which looks like this: LR ID Kmer ProcID 1 GTACGTAT 10 1 TACGTATC 10 1 ACGTATCG 2 1 ...
Ashi's user avatar
  • 61
0 votes
1 answer
81 views

I'm trying to implement Longest Common Subsequence algorithm in c, the matrices c[][] stores the length of the longest common subsequence, row[][] stores the parent block row in the c[][] matrix and ...
Debal Ghosh's user avatar
-1 votes
2 answers
718 views

I have sent hours trying to find out the reason why the method returns a wrong answer for this particular test case: "qrsvbspk". The method returns 6 instead of 5. I cannot figure out what ...
msbtech's user avatar
  • 21
-4 votes
1 answer
149 views

i'm trying to print the longest word from a string and to ignore the number, so even though the number is the longest, it will print the longest word. let userInput = "print the longest word ...
orela123's user avatar
1 vote
2 answers
985 views

How can I write an R function that can take two string vectors and returns the number of common words AND which common words comparing element 1 from stringvec1 to element 1 of stringvec2, element 2 ...
Neal Barsch's user avatar
  • 2,950
2 votes
2 answers
2k views

I have a programm that can find the longest repeating substring of entered string, but the thing is, when there are 2 repeating substrings of the biggest length in answer I get only one of them. For ...
Alice's user avatar
  • 45
0 votes
1 answer
35 views

Index Error , List index out of range In "if" statement, the second line gives the above specific error You can see the value of index(ind) being used for the list(temp). It is clearly not ...
Satyam's user avatar
  • 49
2 votes
1 answer
1k views

Given a long string, find the longest repeated sub-string. The brute-force approach of course is to find all substrings and check the substrings of the remaining string, but the string(s) in question ...
Dragon-Ash's user avatar
2 votes
1 answer
2k views

I was solving this longest palindromic substring problem on leetcode and I followed the dynamic programming approach by creating one n*n boolean table(which I guess is also the standard solution to ...
NITESH SHARMA's user avatar
1 vote
1 answer
299 views

If you comparing these two solutions the time complexity of the first solution is O(array-len*sortest-string-len) that you may shorten it to O(n*m) or even O(n^2). And the second one seems O(n * log n)...
Hamid Mayeli's user avatar
  • 1,188
-2 votes
1 answer
666 views

I am new to this platform so please bear with me. My program was based on the longest substring problem with no mismatches using Dynamic Programming. Here is a link to the D-P solution. https://www....
Adeeb Akhtar's user avatar
0 votes
1 answer
94 views

I have a recursive solution to the longest common subsequence problem of two strings given below: def LCS(i, j, lcs): # i , j are the position of character in X and Y respectively which are being ...
Mr Sukhe's user avatar