Category: python
Given a 2D Grid with integer values representing the colours, you are asked (in an interview probably) to find out the maximum connected colour sizes. A colour is connected …
Implement a thread safe bounded blocking queue that has the following methods: BoundedBlockingQueue(int capacity) The constructor initializes the queue with a maximum capacity. void enqueue(int element) Adds an element …
How to Find the Index of Given Element in String/Tuple/List in Python? The index() in Python gives the lowest index that element matches the target. The index starts at …
A robot on an infinite grid starts at point (0, 0) and faces north. The robot can receive one of three possible types of commands: -2: turn left 90 …
A queue is a first-in-first-out (FIFO) data structure. We all know that the list/array in Python is very powerful, that it can be used as a queue itself. For …