Stokastik

Machine Learning, AI and Programming

Tag: Constant Space

Leetcode : Self Crossing

Problem Statement Solution: The brute force approach would be to store the starting and the ending co-ordinates for each line segment in an array A and then for the current segment, check if it intersects or "touches" any one of the previous line segments present in the array A. The run-time and space complexity of this approach is O(N2) where N is the number of line segments. Can we do […]

Continue Reading →