Skip to content
Advertisement

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 referred to as being between the two arrays. You

Is it possible to decrement counter within a condition?

i am trying to detect a jokerStraightFlush when analysing a poker hand. I need to add a feature where this hand works 8S JK 6S JK 4S. The JK are jokers. I am using the exact same code logic as https://www.codeproject.com/Articles/38821/Make-a-poker-hand-evalutator-in-Java. cardsTable represents the distribution of the Card ranks present in the hand. Each element of this array represents the

Can’t access my linked list methods and can’t iterate trough it

So im following along this playlist about data structures and in this video to conclude the linked list part, the professor explain we need an inner class called IteratorHelper. Video: https://www.youtube.com/watch?v=bx0ebSGUKto&list=PLpPXw4zFa0uKKhaSz87IowJnOTzh9tiBk&index=21 This is the code in my github with the linked list implementation and the main class called tester: https://github.com/Ghevi/Algos-DataStructures/tree/master/src/com/ghevi/ads/linkedlists The problem is that the tester class can’t compile. If

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 problem? My current solution handles: an empty input

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 approaches with regex and without regex. Answer Without regex, you

Advertisement