1621. Number of Sets of K Non-Overlapping Line Segments
Last updated
Last updated
**Input:** n = 4, k = 2
**Output:** 5
**Explanation:**The two line segments are shown in red and blue.
The image above shows the 5 different ways {(0,2),(2,3)}, {(0,1),(1,3)}, {(0,1),(2,3)}, {(1,2),(2,3)}, {(0,1),(1,2)}.**Input:** n = 3, k = 1
**Output:** 3
**Explanation:** The 3 ways are {(0,1)}, {(0,2)}, {(1,2)}.**Input:** n = 30, k = 7
**Output:** 796297179
**Explanation:** The total number of possible ways to draw 7 line segments is 3796297200. Taking this number modulo 109 + 7 gives us 796297179.**Input:** n = 5, k = 3
**Output:** 7**Input:** n = 3, k = 2
**Output:** 1