matching

How to calculate percentage while matching columns on video_id?

How to calculate percentage while matching columns on video_id? Question: I am trying to calculate a percentage of users who view a specific video and those who do not. I managed to calculate the total number of videos and also total number of videos viewed by each group. However, when I try to calculate the …

Total answers: 1

Debugging in Hungarian Maximum Matching

Debugging in Hungarian Maximum Matching Question: I wrote a code to solve the following algorithm question: Given a number of positive integers all larger than 1, find the maximum number of pairs whose sum is a prime number. The number of positive integers is always an even number. For example, given 2 5 6 13 …

Total answers: 1

Validate an alphanumeric string that contains a fixed amount of non-consecutive periods

Validate an alphanumeric string that contains a fixed amount of non-consecutive periods Question: I have a string that looks like that "—-.——-.—–.—". Here —- is any substring of random length, . is the separator and the string can have a predetermined number of separator that I can dynamically change. How can I use regex to …

Total answers: 2

What would be the regex pattern for the following?

What would be the regex pattern for the following? Question: I have multiple regex strings in format:- Example: A=’AB.224-QW-2018′ B=’AB.876-5-LS-2018′ C=’AB.26-LS-18′ D=’AB-123-6-LS-2017′ E=’IA-Mb-22L-AB.224-QW-2018-IA-Mb-22L’ F=’ZX-ss-12L-AB-123-6-LS-2017-BC-22′ G=’AB.224-2018′ H=”AB.224/QW/2018′ I=”AB/224/2018′ J=’AB-10-HDB-231-NCLT-1-2017 AD-42-HH-2019′ K=”AB-1-HDB-NCLT-1-2016 AD-42-HH-2020′ L=’AB-1-HDB-NCLT-1-2016/(AD-42-HH-2020) I want a regex pattern to get the output for the numbers that occur after the alphabets(that appear at the start) as well …

Total answers: 2

Cannot pattern match patterns ending with specific characters

Cannot pattern match patterns ending with specific characters Question: I’m trying to match all patterns that end in bar. This is my regex pattern ".*bar$". I get no result… same thing happens if I use the carrot in to match at the beginning of patterns. string = """ foo bar baz bar foo baz baz …

Total answers: 3

Brute force pattern algorithm

Brute force pattern algorithm Question: Using Python, how would you implement a brute-force string matching algorithm? It should find a pattern (string of m characters) in a text (string of n characters). Verify your code with outputs from following test cases: Test case#1: Text: 10110100110010111 Pattern: 001011 Test case#2: Text: It is never too late …

Total answers: 1

matching elements from one set to another using given metric

matching elements from one set to another using given metric Question: First, I’d like to say I’m not looking for code, I’m looking for an algorithm. Motivation: I’m writing top-level testing of a complex real-time software system. It runs all software components (~20 processes, ~100 threads), sets up fake data sources (rtsp video sources) and …

Total answers: 2

Python: Speed up matching in multiple lists

Python: Speed up matching in multiple lists Question: I have four lists like these: L = [ (1,2), (3,5), (6,10), (7,8) ] M = [ (1,3), (8,9), (12,13) ] N = [ (6,10), (3,4), (5,6), (10,11), (12,13) ] T = [ (6,10) , (1,4) ] I want to check the presence/absence of every tuple of …

Total answers: 4