Skip to content

Tag: algorithm

Finding overlapped intervals in a set of intervals

We have a login system that tracks how long people are connected. I would like to write a code to find people who were online at the same time. Look at this example, please: Think of these as intervals of Person 1 to 4. I want the output of the algorithm to be something like this: I tried to solve

Check substring with 1 character difference in python

I have list of thousand of strings sub_strings, and list of millions of strings strings I want to check if strings[i] have substring from sub_strings or substring that’s different in 1 character expected Answer Here’s a route for solving: That will spit out [True, True, True, True, False, True] Bu…

Power Plant – solve the problem in O(nlogn)

I had the following problem on the exam: A certain power plant needs coal to operate, so it has ordered n deliveries, and information about each delivery (number of tons) is stored in a list A. The delivered coal is stored in warehouses with consecutive numbers 0, 1, …. (Their exact number is not given)…