Input: n = 3
Output: 3
Explanation: The 3x3
multiplication table is as follows:
1 2 3
2 4 6
3 6 9
The sorted elements are: [1, 2, 2, 3, 3, 4, 6, 6, 9]
. The middle element is 3
.
Input: n = 5
Output: 8
Explanation: The 5x5
multiplication table is as follows:
1 2 3 4 5
2 4 6 8 10
3 6 9 12 15
4 8 12 16 20
5 10 15 20 25
The sorted elements are: [1, 2, 2, 3, 3, 4, 4, 4, 5, 5, 6, 6, 8, 8, 9, 10, 10, 12, 12, 15, 15, 16, 20, 20, 25]
. The middle element is 8
.