728x90 Max Nonoverlapping Segments1 [Codility] Lesson16 - Greedy algorithms: Max Nonoverlapping Segments Problem Located on a line are N segments, numbered from 0 to N − 1, whose positions are given in arrays A and B. For each I (0 ≤ I < N) the position of segment I is from A[I] to B[I] (inclusive). The segments are sorted by their ends, which means that B[K] ≤ B[K + 1] for K such that 0 ≤ K < N − 1. Two segments I and J, such that I ≠ J, are overlapping if they share at least one common point. In .. 2021. 2. 10. 이전 1 다음 728x90