All Questions
3,266
questions
2
votes
3
answers
100
views
How to determine an overlapping sequence of words between two texts
In one of our digital assignments, I had asked my students to read an article and write a few things they learned from that article. Students were told that they were supposed to write using their ...
2
votes
4
answers
160
views
Finding longest substring u of w such that uuu is a substring in w
Given a string w, how do I find the longest substring u such that uuu is contained in w?
I can compute the suffix array and corresponding LCP array of w reasonably fast in python. I tried to get the ...
1
vote
1
answer
104
views
Reversing characters of string of parenthesis to achieve at max H string depth
Given a integer H and string s which contains only ( and ) characters, and is properly formed (every opening bracket has corresponding closing bracket, the pairs of brackets are properly nested), ...
0
votes
1
answer
22
views
Average of two strings in alphabetical/lexicographical order with `PAD SPACE` Rules
This is a followup of questions/2510755
What's the best way to find the average of 2 strings with an added constraint that trailing space does not matter to the comparison (the way databases do a PAD ...
0
votes
5
answers
159
views
Comparing a string that is reversed (palindrome)
I am using the below function and getting the below output. Can someone please explain why.
It prints out that they are equal after the for loop finishes but when compared the logic says they are not ...
0
votes
4
answers
161
views
Find substrings that contain a certain amount of certain characters
I have a string like GGACATCGCGGTGGATCGAC.
How can I find all substrings that contain, for example, three Gs in any order?
For this string, it would be GCGG or GTGG, or GGACATCG.
Also need to find ...
3
votes
3
answers
159
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 ...
0
votes
1
answer
47
views
Identify <, >, & and replace it with < ,> , & in a given string, where they are appearing individually and not part of a html or ssml tag [closed]
Need a Javascript code snippet that can identify <, >, & and replace it with < ,> , & in a given string, where they are appearing individually and not part of a html or ssml tag.
...
3
votes
0
answers
78
views
Wierd pattern of hybrid radix+quick sort
I was doing my homework for algorithms course, and it was about string sorting algorithms. I was to implement different algorithms, count the number of symbol comparisons, draw a graph and explain the ...
0
votes
1
answer
47
views
Permutation in String: Why my code is giving false positives?
I am trying to solve LeetCode problem Permutation in String:
Given two strings s1 and s2, return true if s2 contains a permutation of s1, or false otherwise.
In other words, return true if one of s1'...
0
votes
0
answers
30
views
Determine the next position of the proper prefix of the pattern string
When I learn Knuth–Morris–Pratt algorithm, I got a function f from the book Fundamentals of Data Structures in C.
If p="p0 p1 ...p(n-1)" is a pattern, then its failure function, f, is ...
0
votes
1
answer
84
views
Find all prefixes of a word that are stored in a binary search tree
I have a binary search tree storing strings. The strings are compared lexicographically (with strcmp in c).
Given some input string, I want to retrieve a list of all the prefixes of that string that ...
0
votes
0
answers
27
views
generate a graph between 15k+ strings of recipe ingredients
you know real world data is messy, and i have an interesting problem that i cannot find the solution to or cannot find the right keywords to search.
so i have about 15k+ recipe ingredients written in ...
0
votes
0
answers
51
views
Finding contiguous words in a list which match the string
In our application, we are reading the text from PDF and processing it.
I'm stuck with a scenario which is as below:
Suppose, I have below lines in a PDF page:
It's raining in the evening
John is ...
0
votes
0
answers
34
views
Task from Brazil ICPC with translating z-array(z-function) to prefix-array(KMP function) and vise-versa
I was working on a task from Brazil ICPC with translating z-array(z-function) to prefix-array(KMP function) and vise-versa.
And there still some failed tests by RTE and one test shows a Wrong Answer ...