Skip to content

Tag: algorithm

Problem in “between two set” hackerrank problem

Problem:You will be given two arrays of integers and asked to determine all integers that satisfy the following two conditions: The elements of the first array are all factors of the integer being considered The integer being considered is a factor of all elements of the second array These numbers are referre…

Remove last occurrence of a specific integer from an array

For some reason, my solution is not complete. I got 80/100 from hidden spec tests. What’s wrong with my solution? There is probably a certain use case that I’m not thinking of. How would space/time complexity change using an ArrayList instead of an array? Is there a better way to tackle this probl…

How to check if string has repeating pattern?

I was recently asked this in an interview question: Given a input string check if it has repeating pattern and return true or false. For example: “abbaabbaabbaabba” is a repeating pattern of “abba” How can we solve it using regex and also without regex? I am interested in both the appr…