Skip to main content

All Questions

Tagged with
0 votes
1 answer
606 views

Algorithm to find the highest Tetromino in a Tetris board?

Lets say that our Tetris board is represented as a 2D array of zeros and ones, where a 0 means empty and 1 means occupied, and you where asked to find the highest row in which a tetromino exists. ...
Raed Tabani's user avatar
0 votes
3 answers
7k views

Find all lines segments intersections

I have a collection of lines segments, represented by an array. Ex: [3,7,13,6,9] is 4 line segments: [(3,7)(7,13)] , [(7,13)(13,6)] , [(13,6)(6,9)] , ([6,9)(9,3)] I want to find all the lines ...
Ilya Gazman's user avatar
3 votes
5 answers
8k views

How do you find the first common element in two arrays

How do you find the first common element in two arrays? My attempt: I looped through each at the same time and add the current value to a separate set for each of the lists. Also, check if the current ...
user1136342's user avatar