Live: Uncrossed Lines

Published: 01 January 1970
on channel: Coding Blocks
144
2

We write the integers of A and B (in the order they are given) on two separate horizontal lines.

Now, we may draw connecting lines: a straight line connecting two numbers A[i] and B[j] such that:

A[i] == B[j];
The line we draw does not intersect any other connecting (non-horizontal) line.

Note that a connecting lines cannot intersect even at the endpoints: each number can only belong to one connecting line.

Return the maximum number of connecting lines we can draw in this way.

https://leetcode.com/explore/challeng...


Watch video Live: Uncrossed Lines online without registration, duration hours minute second in high quality. This video was added by user Coding Blocks 01 January 1970, don't forget to share it with your friends and acquaintances, it has been viewed on our site 144 once and liked it 2 people.