Algorithms
Medium
2829
2811
Determine the Minimum Sum of a k-avoiding Array
determine-the-minimum-sum-of-a-k-avoiding-array
"""
You are given two integers, n and k.

An array of distinct positive integers is called a k-avoiding array if there does not exist any pair of distinct elements that sum to k.

Return the minimum possible sum of a k-avoiding array of length n.

Example 1:

Input: n = 5, k = 4
Output: 18
Explanation: Consider the k-avoiding array [1,2,4,5,6], which has a sum of 18.
It can be proven that there is no k-avoiding array with a sum less than 18.

Example 2:

Input: n = 2, k = 6
Output: 3
Explanation: We can construct the array [1,2], which has a sum of 3.
It can be proven that there is no k-avoiding array with a sum less than 3.


Constraints:

 * 1 <= n, k <= 50
"""
class Solution:
    def minimumSum(self, n: int, k: int) -> int:
        
You are given two integers, n and k.

An array of distinct positive integers is called a k-avoiding array if there does not exist any pair of distinct elements that sum to k.

Return the minimum possible sum of a k-avoiding array of length n.

Example 1:

Input: n = 5, k = 4
Output: 18
Explanation: Consider the k-avoiding array [1,2,4,5,6], which has a sum of 18.
It can be proven that there is no k-avoiding array with a sum less than 18.

Example 2:

Input: n = 2, k = 6
Output: 3
Explanation: We can construct the array [1,2], which has a sum of 3.
It can be proven that there is no k-avoiding array with a sum less than 3.


Constraints:

 * 1 <= n, k <= 50


Please complete the code below to solve above prblem:
```python
class Solution:
    def minimumSum(self, n: int, k: int) -> int:
        
```

my_solution = Solution()

test_input = { "n": 5, "k": 4 }
assert my_solution.minimumSum(**test_input) == 18

test_input = { "n": 2, "k": 6 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 1, "k": 1 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 2 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 3 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 4 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 5 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 6 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 7 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 8 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 9 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 10 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 11 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 12 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 13 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 14 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 15 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 16 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 17 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 18 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 19 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 20 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 21 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 22 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 23 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 24 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 25 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 26 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 27 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 28 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 29 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 30 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 31 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 32 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 33 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 34 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 35 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 36 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 37 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 38 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 39 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 40 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 41 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 42 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 43 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 44 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 45 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 46 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 47 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 48 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 49 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 1, "k": 50 }
assert my_solution.minimumSum(**test_input) == 1

test_input = { "n": 2, "k": 1 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 2 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 3 }
assert my_solution.minimumSum(**test_input) == 4

test_input = { "n": 2, "k": 4 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 5 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 7 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 8 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 9 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 10 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 11 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 12 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 13 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 14 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 15 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 16 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 17 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 18 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 19 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 20 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 21 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 22 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 23 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 24 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 25 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 26 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 27 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 28 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 29 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 30 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 31 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 32 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 33 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 34 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 35 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 36 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 37 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 38 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 39 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 40 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 41 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 42 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 43 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 44 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 45 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 46 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 47 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 48 }
assert my_solution.minimumSum(**test_input) == 3

test_input = { "n": 2, "k": 49 }
assert my_solution.minimumSum(**test_input) == 3