split-strings-by-separator

Split Strings by Separator

Prompt:
"""
Given an array of strings words and a character separator, split each string in words by separator.

Return an array of strings containing the new strings formed after the splits, excluding empty strings.

Notes

 * separator is used to determine where the split should occur, but it is not included as part of the resulting strings.
 * A split may result in more than two strings.
 * The resulting strings must maintain the same order as they were initially given.

Example 1:

Input: words = ["one.two.three","four.five","six"], separator = "."
Output: ["one","two","three","four","five","six"]
Explanation: In this example we split as follows:

"one.two.three" splits into "one", "two", "three"
"four.five" splits into "four", "five"
"six" splits into "six"

Hence, the resulting array is ["one","two","three","four","five","six"].

Example 2:

Input: words = ["$easy$","$problem$"], separator = "$"
Output: ["easy","problem"]
Explanation: In this example we split as follows:

"$easy$" splits into "easy" (excluding empty strings)
"$problem$" splits into "problem" (excluding empty strings)

Hence, the resulting array is ["easy","problem"].

Example 3:

Input: words = ["|||"], separator = "|"
Output: []
Explanation: In this example the resulting split of "|||" will contain only empty strings, so we return an empty array [].

Constraints:

 * 1 <= words.length <= 100
 * 1 <= words[i].length <= 20
 * characters in words[i] are either lowercase English letters or characters from the string ".,|$#@" (excluding the quotes)
 * separator is a character from the string ".,|$#@" (excluding the quotes)
"""
class Solution:
    def splitWordsBySeparator(self, words: List[str], separator: str) -> List[str]:

Given an array of strings words and a character separator, split each string in words by separator.

Return an array of strings containing the new strings formed after the splits, excluding empty strings.

Notes

 * separator is used to determine where the split should occur, but it is not included as part of the resulting strings.
 * A split may result in more than two strings.
 * The resulting strings must maintain the same order as they were initially given.

Example 1:

Input: words = ["one.two.three","four.five","six"], separator = "."
Output: ["one","two","three","four","five","six"]
Explanation: In this example we split as follows:

"one.two.three" splits into "one", "two", "three"
"four.five" splits into "four", "five"
"six" splits into "six"

Hence, the resulting array is ["one","two","three","four","five","six"].

Example 2:

Input: words = ["$easy$","$problem$"], separator = "$"
Output: ["easy","problem"]
Explanation: In this example we split as follows:

"$easy$" splits into "easy" (excluding empty strings)
"$problem$" splits into "problem" (excluding empty strings)

Hence, the resulting array is ["easy","problem"].

Example 3:

Input: words = ["|||"], separator = "|"
Output: []
Explanation: In this example the resulting split of "|||" will contain only empty strings, so we return an empty array [].

Constraints:

 * 1 <= words.length <= 100
 * 1 <= words[i].length <= 20
 * characters in words[i] are either lowercase English letters or characters from the string ".,|$#@" (excluding the quotes)
 * separator is a character from the string ".,|$#@" (excluding the quotes)

Please complete the code below to solve above prblem:
```python
class Solution:
    def splitWordsBySeparator(self, words: List[str], separator: str) -> List[str]:

```

my_solution = Solution()

test_input = { "words": ["one.two.three","four.five","six"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["one","two","three","four","five","six"]

test_input = { "words": ["$easy$","$problem$"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["easy","problem"]

test_input = { "words": ["|||"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == []

test_input = { "words": ["stars.bars.$"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["stars","bars","$"]

test_input = { "words": ["###x#i@f"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == ["x","i@f"]

test_input = { "words": ["##q@t#"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == ["q@t"]

test_input = { "words": ["#,"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == [","]

test_input = { "words": ["#@"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["#"]

test_input = { "words": ["#a$f$nwgq#vw"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["#a","f","nwgq#vw"]

test_input = { "words": ["#uyddd,trxiwfv"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["#uyddd","trxiwfv"]

test_input = { "words": ["#x"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["#x"]

test_input = { "words": ["#x#,"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["#x#"]

test_input = { "words": ["#|"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == ["|"]

test_input = { "words": ["#|a|b|##|#|#g#u|"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["#","a","b","##","#","#g#u"]

test_input = { "words": ["$$.o.$$."], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == [".o.","."]

test_input = { "words": ["$,,"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["$"]

test_input = { "words": ["$j@@@"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["$j"]

test_input = { "words": [",$$"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == [","]

test_input = { "words": [",,"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == [",,"]

test_input = { "words": [",,,@@n"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["@@n"]

test_input = { "words": [",,,@o,"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["@o"]

test_input = { "words": [",,,p,#r#"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["p","#r#"]

test_input = { "words": [",,."], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["."]

test_input = { "words": [",,ulxh|,u|ustg||ulo"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == [",,ulxh",",u","ustg","ulo"]

test_input = { "words": [",esplco"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == [",esplco"]

test_input = { "words": [",g#,,,#"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["g#","#"]

test_input = { "words": [",gko"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == [",gko"]

test_input = { "words": [",h,u.f"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["h","u.f"]

test_input = { "words": [",y|z|bg,"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == [",y","z","bg,"]

test_input = { "words": [".#z.###b"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == [".","z.","b"]

test_input = { "words": [".."], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == []

test_input = { "words": [".@"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["@"]

test_input = { "words": [".n#.#.."], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == [".n",".",".."]

test_input = { "words": [".trs.t..cvvw.,..p"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["trs","t","cvvw",",","p"]

test_input = { "words": [".vy.$$.qw"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["vy","$$","qw"]

test_input = { "words": ["@,,"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == [",,"]

test_input = { "words": ["@..@@.s.@u@.@"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["@","@@","s","@u@","@"]

test_input = { "words": ["@@..@@@.@vn@"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["@@","@@@","@vn@"]

test_input = { "words": ["@@@@@@@...@@@"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["@@@@@@@","@@@"]

test_input = { "words": ["@@@@@@g@@v"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["g","v"]

test_input = { "words": ["@@||@"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["@@","@"]

test_input = { "words": ["@acp.@"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["@acp","@"]

test_input = { "words": ["@iw"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["@iw"]

test_input = { "words": ["@z#y@@ni"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == ["@z","y@@ni"]

test_input = { "words": ["aovx"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["aovx"]

test_input = { "words": ["b"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["b"]

test_input = { "words": ["b,,"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["b,,"]

test_input = { "words": ["b,s"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["b","s"]

test_input = { "words": ["bqukl,bv"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["bqukl","bv"]

test_input = { "words": ["cmypa#"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == ["cmypa"]

test_input = { "words": ["cq,,,,y"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["cq,,,,y"]

test_input = { "words": ["d,,,@d"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["d","@d"]

test_input = { "words": ["dgjtc"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["dgjtc"]

test_input = { "words": ["e$,$,w$,,z,,$$,"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["e$","$","w$","z","$$"]

test_input = { "words": ["e,,$,$,,,"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["e","$","$"]

test_input = { "words": ["edz."], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["edz."]

test_input = { "words": ["f"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["f"]

test_input = { "words": ["f."], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["f."]

test_input = { "words": ["g"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["g"]

test_input = { "words": ["g###"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["g###"]

test_input = { "words": ["g|@@@@@|"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["g|","|"]

test_input = { "words": ["h"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["h"]

test_input = { "words": ["h#"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == ["h"]

test_input = { "words": ["hpo"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["hpo"]

test_input = { "words": ["imq#zect"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["imq#zect"]

test_input = { "words": ["io@"], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["io@"]

test_input = { "words": ["j@..@f.v@."], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["j","..","f.v","."]

test_input = { "words": ["jxe|xfim"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["jxe","xfim"]

test_input = { "words": ["lyegjxsg"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["lyegjxsg"]

test_input = { "words": ["l|"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["l|"]

test_input = { "words": ["mm..,.j.."], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["mm",",","j"]

test_input = { "words": ["n."], "separator": "." }
assert my_solution.splitWordsBySeparator(**test_input) == ["n"]

test_input = { "words": ["no#"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["no#"]

test_input = { "words": ["nyy|"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["nyy"]

test_input = { "words": ["pfx|ons"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["pfx|ons"]

test_input = { "words": ["pl"], "separator": "#" }
assert my_solution.splitWordsBySeparator(**test_input) == ["pl"]

test_input = { "words": ["q"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["q"]

test_input = { "words": ["q"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["q"]

test_input = { "words": ["qv"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["qv"]

test_input = { "words": ["r"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["r"]

test_input = { "words": ["rxs|$mg"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["rxs|","mg"]

test_input = { "words": ["sls,l,xn"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["sls","l","xn"]

test_input = { "words": ["t@"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["t"]

test_input = { "words": ["tsklm|dhmsr"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["tsklm","dhmsr"]

test_input = { "words": ["t|@@w||"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["t","@@w"]

test_input = { "words": ["u"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["u"]

test_input = { "words": ["ufjvddie"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["ufjvddie"]

test_input = { "words": ["unvywqeuqvdq"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["unvywqeuqvdq"]

test_input = { "words": ["vt@"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["vt"]

test_input = { "words": ["w,xu#v,m,jh,"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["w","xu#v","m","jh"]

test_input = { "words": ["w|vip|"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["w","vip"]

test_input = { "words": ["xjmjh$@"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["xjmjh$"]

test_input = { "words": ["xm,tjd$"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["xm,tjd"]

test_input = { "words": ["yww"], "separator": "@" }
assert my_solution.splitWordsBySeparator(**test_input) == ["yww"]

test_input = { "words": ["z"], "separator": "$" }
assert my_solution.splitWordsBySeparator(**test_input) == ["z"]

test_input = { "words": ["z#|||###"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["z#","###"]

test_input = { "words": ["zb@"], "separator": "," }
assert my_solution.splitWordsBySeparator(**test_input) == ["zb@"]

test_input = { "words": ["|,,|,|||"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == [",,",","]

test_input = { "words": ["|,r,fg"], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == [",r,fg"]

test_input = { "words": ["|."], "separator": "|" }
assert my_solution.splitWordsBySeparator(**test_input) == ["."]


largest-element-in-an-array-after-merge-operations

Largest Element in an Array after Merge Operations

Prompt:
"""
You are given a 0-indexed array nums consisting of positive integers.

You can do the following operation on the array any number of times:

 * Choose an integer i such that 0 <= i < nums.length - 1 and nums[i] <= nums[i + 1]. Replace the element nums[i + 1] with nums[i] + nums[i + 1] and delete the element nums[i] from the array.

Return the value of the largest element that you can possibly obtain in the final array.

Example 1:

Input: nums = [2,3,7,9,3]
Output: 21
Explanation: We can apply the following operations on the array:
- Choose i = 0. The resulting array will be nums = [5,7,9,3].
- Choose i = 1. The resulting array will be nums = [5,16,3].
- Choose i = 0. The resulting array will be nums = [21,3].
The largest element in the final array is 21. It can be shown that we cannot obtain a larger element.

Example 2:

Input: nums = [5,3,3]
Output: 11
Explanation: We can do the following operations on the array:
- Choose i = 1. The resulting array will be nums = [5,6].
- Choose i = 0. The resulting array will be nums = [11].
There is only one element in the final array, which is 11.

Constraints:

 * 1 <= nums.length <= 105
 * 1 <= nums[i] <= 106
"""
class Solution:
    def maxArrayValue(self, nums: List[int]) -> int:

You are given a 0-indexed array nums consisting of positive integers.

You can do the following operation on the array any number of times:

 * Choose an integer i such that 0 <= i < nums.length - 1 and nums[i] <= nums[i + 1]. Replace the element nums[i + 1] with nums[i] + nums[i + 1] and delete the element nums[i] from the array.

Return the value of the largest element that you can possibly obtain in the final array.

Example 1:

Input: nums = [2,3,7,9,3]
Output: 21
Explanation: We can apply the following operations on the array:
- Choose i = 0. The resulting array will be nums = [5,7,9,3].
- Choose i = 1. The resulting array will be nums = [5,16,3].
- Choose i = 0. The resulting array will be nums = [21,3].
The largest element in the final array is 21. It can be shown that we cannot obtain a larger element.

Example 2:

Input: nums = [5,3,3]
Output: 11
Explanation: We can do the following operations on the array:
- Choose i = 1. The resulting array will be nums = [5,6].
- Choose i = 0. The resulting array will be nums = [11].
There is only one element in the final array, which is 11.

Constraints:

 * 1 <= nums.length <= 105
 * 1 <= nums[i] <= 106

Please complete the code below to solve above prblem:
```python
class Solution:
    def maxArrayValue(self, nums: List[int]) -> int:

```


maximum-number-of-groups-with-increasing-length

Maximum Number of Groups With Increasing Length

Prompt:
"""
You are given a 0-indexed array usageLimits of length n.

Your task is to create groups using numbers from 0 to n - 1, ensuring that each number, i, is used no more than usageLimits[i] times in total across all groups. You must also satisfy the following conditions:

 * Each group must consist of distinct numbers, meaning that no duplicate numbers are allowed within a single group.
 * Each group (except the first one) must have a length strictly greater than the previous group.

Return an integer denoting the maximum number of groups you can create while satisfying these conditions.

Example 1:

Input: usageLimits = [1,2,5]
Output: 3
Explanation: In this example, we can use 0 at most once, 1 at most twice, and 2 at most five times.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [2].
Group 2 contains the numbers [1,2].
Group 3 contains the numbers [0,1,2].
It can be shown that the maximum number of groups is 3.
So, the output is 3.

Example 2:

Input: usageLimits = [2,1,2]
Output: 2
Explanation: In this example, we can use 0 at most twice, 1 at most once, and 2 at most twice.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [0].
Group 2 contains the numbers [1,2].
It can be shown that the maximum number of groups is 2.
So, the output is 2.

Example 3:

Input: usageLimits = [1,1]
Output: 1
Explanation: In this example, we can use both 0 and 1 at most once.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [0].
It can be shown that the maximum number of groups is 1.
So, the output is 1.

Constraints:

 * 1 <= usageLimits.length <= 105
 * 1 <= usageLimits[i] <= 109
"""
class Solution:
    def maxIncreasingGroups(self, usageLimits: List[int]) -> int:

You are given a 0-indexed array usageLimits of length n.

Your task is to create groups using numbers from 0 to n - 1, ensuring that each number, i, is used no more than usageLimits[i] times in total across all groups. You must also satisfy the following conditions:

 * Each group must consist of distinct numbers, meaning that no duplicate numbers are allowed within a single group.
 * Each group (except the first one) must have a length strictly greater than the previous group.

Return an integer denoting the maximum number of groups you can create while satisfying these conditions.

Example 1:

Input: usageLimits = [1,2,5]
Output: 3
Explanation: In this example, we can use 0 at most once, 1 at most twice, and 2 at most five times.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [2].
Group 2 contains the numbers [1,2].
Group 3 contains the numbers [0,1,2].
It can be shown that the maximum number of groups is 3.
So, the output is 3.

Example 2:

Input: usageLimits = [2,1,2]
Output: 2
Explanation: In this example, we can use 0 at most twice, 1 at most once, and 2 at most twice.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [0].
Group 2 contains the numbers [1,2].
It can be shown that the maximum number of groups is 2.
So, the output is 2.

Example 3:

Input: usageLimits = [1,1]
Output: 1
Explanation: In this example, we can use both 0 and 1 at most once.
One way of creating the maximum number of groups while satisfying the conditions is:
Group 1 contains the number [0].
It can be shown that the maximum number of groups is 1.
So, the output is 1.

Constraints:

 * 1 <= usageLimits.length <= 105
 * 1 <= usageLimits[i] <= 109

Please complete the code below to solve above prblem:
```python
class Solution:
    def maxIncreasingGroups(self, usageLimits: List[int]) -> int:

```

my_solution = Solution()

test_input = { "usageLimits": [1,2,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [2,1,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [1,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 1

test_input = { "usageLimits": [1,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [1,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [1,7] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [1,8] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [2,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [2,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [2,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [2,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [2,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [2,7] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [2,8] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [2,9] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [3,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [3,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [3,7] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [3,10] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [4,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [4,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [4,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [4,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [4,7] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [4,10] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [5,8] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [5,10] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [6,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [6,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [6,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [6,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [6,6] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [6,7] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [6,9] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [6,19] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [7,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [7,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [7,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [7,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [7,7] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [7,13] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [8,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [8,6] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [9,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [9,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [9,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [9,6] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [9,8] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [9,10] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [10,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [10,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [10,8] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [10,11] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [13,11] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [13,13] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [16,9] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [18,6] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [32,42] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [1,1,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [1,1,10] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [1,4,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [1,4,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [1,6,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [1,6,8] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [1,7,19] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [1,8,6] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [1,9,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [1,9,6] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [1,10,6] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [2,2,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [2,3,8] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [2,6,10] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [2,7,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [2,7,7] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [2,8,7] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [2,9,9] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [3,1,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 2

test_input = { "usageLimits": [3,5,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [3,5,8] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [3,6,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [3,7,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [3,7,10] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [3,8,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [3,9,9] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [3,10,9] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [4,2,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [4,2,15] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [4,5,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [4,7,9] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [4,8,2] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [4,8,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [4,10,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [4,10,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [5,1,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [5,2,9] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [5,2,10] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [5,6,1] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [5,6,5] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [5,7,4] }
assert my_solution.maxIncreasingGroups(**test_input) == 3

test_input = { "usageLimits": [5,10,3] }
assert my_solution.maxIncreasingGroups(**test_input) == 3


count-paths-that-can-form-a-palindrome-in-a-tree

Count Paths That Can Form a Palindrome in a Tree

Prompt:
"""
You are given a tree (i.e. a connected, undirected graph that has no cycles) rooted at node 0 consisting of n nodes numbered from 0 to n - 1. The tree is represented by a 0-indexed array parent of size n, where parent[i] is the parent of node i. Since node 0 is the root, parent[0] == -1.

You are also given a string s of length n, where s[i] is the character assigned to the edge between i and parent[i]. s[0] can be ignored.

Return the number of pairs of nodes (u, v) such that u < v and the characters assigned to edges on the path from u to v can be rearranged to form a palindrome.

A string is a palindrome when it reads the same backwards as forwards.

Example 1:

[https://assets.leetcode.com/uploads/2023/07/15/treedrawio-8drawio.png]

Input: parent = [-1,0,0,1,1,2], s = "acaabc"
Output: 8
Explanation: The valid pairs are:
- All the pairs (0,1), (0,2), (1,3), (1,4) and (2,5) result in one character which is always a palindrome.
- The pair (2,3) result in the string "aca" which is a palindrome.
- The pair (1,5) result in the string "cac" which is a palindrome.
- The pair (3,5) result in the string "acac" which can be rearranged into the palindrome "acca".

Example 2:

Input: parent = [-1,0,0,0,0], s = "aaaaa"
Output: 10
Explanation: Any pair of nodes (u,v) where u < v is valid.

Constraints:

 * n == parent.length == s.length
 * 1 <= n <= 105
 * 0 <= parent[i] <= n - 1 for all i >= 1
 * parent[0] == -1
 * parent represents a valid tree.
 * s consists of only lowercase English letters.
"""
class Solution:
    def countPalindromePaths(self, parent: List[int], s: str) -> int:

You are given a tree (i.e. a connected, undirected graph that has no cycles) rooted at node 0 consisting of n nodes numbered from 0 to n - 1. The tree is represented by a 0-indexed array parent of size n, where parent[i] is the parent of node i. Since node 0 is the root, parent[0] == -1.

You are also given a string s of length n, where s[i] is the character assigned to the edge between i and parent[i]. s[0] can be ignored.

Return the number of pairs of nodes (u, v) such that u < v and the characters assigned to edges on the path from u to v can be rearranged to form a palindrome.

A string is a palindrome when it reads the same backwards as forwards.

Example 1:

[https://assets.leetcode.com/uploads/2023/07/15/treedrawio-8drawio.png]

Input: parent = [-1,0,0,1,1,2], s = "acaabc"
Output: 8
Explanation: The valid pairs are:
- All the pairs (0,1), (0,2), (1,3), (1,4) and (2,5) result in one character which is always a palindrome.
- The pair (2,3) result in the string "aca" which is a palindrome.
- The pair (1,5) result in the string "cac" which is a palindrome.
- The pair (3,5) result in the string "acac" which can be rearranged into the palindrome "acca".

Example 2:

Input: parent = [-1,0,0,0,0], s = "aaaaa"
Output: 10
Explanation: Any pair of nodes (u,v) where u < v is valid.

Constraints:

 * n == parent.length == s.length
 * 1 <= n <= 105
 * 0 <= parent[i] <= n - 1 for all i >= 1
 * parent[0] == -1
 * parent represents a valid tree.
 * s consists of only lowercase English letters.

Please complete the code below to solve above prblem:
```python
class Solution:
    def countPalindromePaths(self, parent: List[int], s: str) -> int:

```

my_solution = Solution()

test_input = { "parent": [-1,0,0,1,1,2], "s": "acaabc" }
assert my_solution.countPalindromePaths(**test_input) == 8

test_input = { "parent": [-1,0,0,0,0], "s": "aaaaa" }
assert my_solution.countPalindromePaths(**test_input) == 10

test_input = { "parent": [-1,0], "s": "pi" }
assert my_solution.countPalindromePaths(**test_input) == 1

test_input = { "parent": [-1,5,0,5,5,2], "s": "xsbcqq" }
assert my_solution.countPalindromePaths(**test_input) == 7

test_input = { "parent": [-1,6,8,5,0,4,2,0,4], "s": "tiaiaivea" }
assert my_solution.countPalindromePaths(**test_input) == 20

test_input = { "parent": [-1,0,0,0,1,3,7,2], "s": "pxxgtgpp" }
assert my_solution.countPalindromePaths(**test_input) == 18

test_input = { "parent": [-1,0,1,4,1,0], "s": "hfhmmf" }
assert my_solution.countPalindromePaths(**test_input) == 12

test_input = { "parent": [-1,0,1], "s": "cri" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0,0,5,7,0,0,1,2,0], "s": "snlzlzngna" }
assert my_solution.countPalindromePaths(**test_input) == 19

test_input = { "parent": [-1,0,0], "s": "sat" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0], "s": "ko" }
assert my_solution.countPalindromePaths(**test_input) == 1

test_input = { "parent": [-1,0,6,4,1,6,3,1], "s": "jibwrfoi" }
assert my_solution.countPalindromePaths(**test_input) == 8

test_input = { "parent": [-1,4,0,4,6,0,5,5], "s": "bhrlorou" }
assert my_solution.countPalindromePaths(**test_input) == 18

test_input = { "parent": [-1,4,4,6,0,7,1,1], "s": "boqvndoo" }
assert my_solution.countPalindromePaths(**test_input) == 18

test_input = { "parent": [-1,2,0,1,0], "s": "eixnx" }
assert my_solution.countPalindromePaths(**test_input) == 6

test_input = { "parent": [-1,5,0,2,2,3], "s": "jwlllw" }
assert my_solution.countPalindromePaths(**test_input) == 14

test_input = { "parent": [-1,2,6,2,5,2,7,0], "s": "pipfippl" }
assert my_solution.countPalindromePaths(**test_input) == 15

test_input = { "parent": [-1,6,0,6,5,6,2,6,5,6], "s": "zwrdhnhwtf" }
assert my_solution.countPalindromePaths(**test_input) == 11

test_input = { "parent": [-1,4,1,1,5,0], "s": "gndfnj" }
assert my_solution.countPalindromePaths(**test_input) == 9

test_input = { "parent": [-1,0,0,0,1], "s": "crwkr" }
assert my_solution.countPalindromePaths(**test_input) == 7

test_input = { "parent": [-1,4,4,4,0,2,0], "s": "wwwwewd" }
assert my_solution.countPalindromePaths(**test_input) == 13

test_input = { "parent": [-1,2,0], "s": "mwz" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0,1,6,5,0,1,1,1,0], "s": "mqgmjzrwuq" }
assert my_solution.countPalindromePaths(**test_input) == 14

test_input = { "parent": [-1,2,3,0,3,3,3,3], "s": "bnievjov" }
assert my_solution.countPalindromePaths(**test_input) == 8

test_input = { "parent": [-1,0,0], "s": "kyr" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0,5,1,2,3,2,3,9,4], "s": "xukzwzsnww" }
assert my_solution.countPalindromePaths(**test_input) == 18

test_input = { "parent": [-1,6,0,1,5,0,2,2,6,0], "s": "snlpzocqpt" }
assert my_solution.countPalindromePaths(**test_input) == 10

test_input = { "parent": [-1,3,0,5,5,2], "s": "pxlxpl" }
assert my_solution.countPalindromePaths(**test_input) == 12

test_input = { "parent": [-1,5,5,5,5,0], "s": "ketewj" }
assert my_solution.countPalindromePaths(**test_input) == 6

test_input = { "parent": [-1,0,4,0,0], "s": "zrrqq" }
assert my_solution.countPalindromePaths(**test_input) == 7

test_input = { "parent": [-1,0,0], "s": "qlw" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0,0], "s": "bds" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,2,6,6,0,4,4,2], "s": "odggsrsp" }
assert my_solution.countPalindromePaths(**test_input) == 13

test_input = { "parent": [-1,0,1], "s": "ldk" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0,7,0,6,2,3,3,3], "s": "elllffflv" }
assert my_solution.countPalindromePaths(**test_input) == 28

test_input = { "parent": [-1,4,4,0,0], "s": "ntzhc" }
assert my_solution.countPalindromePaths(**test_input) == 4

test_input = { "parent": [-1,5,4,1,1,0,4], "s": "gmcmavf" }
assert my_solution.countPalindromePaths(**test_input) == 8

test_input = { "parent": [-1,0,0,4,0], "s": "aogkg" }
assert my_solution.countPalindromePaths(**test_input) == 6

test_input = { "parent": [-1,2,0], "s": "xmt" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,2,0], "s": "dff" }
assert my_solution.countPalindromePaths(**test_input) == 3

test_input = { "parent": [-1,0,1,1], "s": "lsvw" }
assert my_solution.countPalindromePaths(**test_input) == 3

test_input = { "parent": [-1,0,0], "s": "ovi" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,6,0,5,2,2,0,3], "s": "lpnfznpf" }
assert my_solution.countPalindromePaths(**test_input) == 19

test_input = { "parent": [-1,7,5,5,0,0,2,2], "s": "hqitxxwi" }
assert my_solution.countPalindromePaths(**test_input) == 16

test_input = { "parent": [-1,2,0], "s": "pyw" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0,0,0], "s": "ybfa" }
assert my_solution.countPalindromePaths(**test_input) == 3

test_input = { "parent": [-1,3,6,6,6,0,0,4], "s": "ulicllkc" }
assert my_solution.countPalindromePaths(**test_input) == 11

test_input = { "parent": [-1,3,1,0], "s": "ukne" }
assert my_solution.countPalindromePaths(**test_input) == 3

test_input = { "parent": [-1,2,0,1,0,0], "s": "rhlxdd" }
assert my_solution.countPalindromePaths(**test_input) == 6

test_input = { "parent": [-1,4,5,0,2,0], "s": "zenbnb" }
assert my_solution.countPalindromePaths(**test_input) == 12

test_input = { "parent": [-1,0,5,4,5,1,3,9,7,4], "s": "jigognjnlb" }
assert my_solution.countPalindromePaths(**test_input) == 12

test_input = { "parent": [-1,4,4,6,3,0,5,3,6], "s": "imrcmdkew" }
assert my_solution.countPalindromePaths(**test_input) == 11

test_input = { "parent": [-1,4,4,0,6,4,0,0], "s": "dqpipiyz" }
assert my_solution.countPalindromePaths(**test_input) == 9

test_input = { "parent": [-1,0,0], "s": "mgm" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0,4,0,1], "s": "pzlob" }
assert my_solution.countPalindromePaths(**test_input) == 4

test_input = { "parent": [-1,8,0,8,8,3,4,4,0,6], "s": "vvbvyovyvy" }
assert my_solution.countPalindromePaths(**test_input) == 30

test_input = { "parent": [-1,0,4,0,5,1,1], "s": "dvrvpea" }
assert my_solution.countPalindromePaths(**test_input) == 9

test_input = { "parent": [-1,0,1], "s": "jnx" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0,1,2], "s": "wxjj" }
assert my_solution.countPalindromePaths(**test_input) == 5

test_input = { "parent": [-1,3,3,0,1,2,1], "s": "erorchx" }
assert my_solution.countPalindromePaths(**test_input) == 9

test_input = { "parent": [-1,0,4,1,1,4,3], "s": "ywzwzcw" }
assert my_solution.countPalindromePaths(**test_input) == 14

test_input = { "parent": [-1,4,6,2,3,3,0], "s": "bititzq" }
assert my_solution.countPalindromePaths(**test_input) == 10

test_input = { "parent": [-1,2,0], "s": "uup" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,2,3,0,0], "s": "siiou" }
assert my_solution.countPalindromePaths(**test_input) == 6

test_input = { "parent": [-1,2,0,2,0], "s": "dilfs" }
assert my_solution.countPalindromePaths(**test_input) == 4

test_input = { "parent": [-1,3,7,0,1,0,2,3,0], "s": "wqojvjoqq" }
assert my_solution.countPalindromePaths(**test_input) == 22

test_input = { "parent": [-1,0], "s": "hi" }
assert my_solution.countPalindromePaths(**test_input) == 1

test_input = { "parent": [-1,3,1,4,0,6,3,1], "s": "fwvwwqqw" }
assert my_solution.countPalindromePaths(**test_input) == 21

test_input = { "parent": [-1,0,4,2,1,1,1], "s": "hkmmkmk" }
assert my_solution.countPalindromePaths(**test_input) == 16

test_input = { "parent": [-1,4,3,1,0], "s": "bzeez" }
assert my_solution.countPalindromePaths(**test_input) == 9

test_input = { "parent": [-1,3,3,0], "s": "zyuj" }
assert my_solution.countPalindromePaths(**test_input) == 3

test_input = { "parent": [-1,0,1,4,6,2,2], "s": "tlcpcll" }
assert my_solution.countPalindromePaths(**test_input) == 13

test_input = { "parent": [-1,2,0], "s": "vjw" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,0], "s": "nz" }
assert my_solution.countPalindromePaths(**test_input) == 1

test_input = { "parent": [-1,0,0], "s": "iot" }
assert my_solution.countPalindromePaths(**test_input) == 2

test_input = { "parent": [-1,2,8,8,3,1,2,0,0], "s": "rlurrluxm" }
assert my_solution.countPalindromePaths(**test_input) == 19

test_input = { "parent": [-1,5,0,0,0,4], "s": "zxrddx" }
assert my_solution.countPalindromePaths(**test_input) == 10

test_input = { "parent": [-1,0,1,2], "s": "tffc" }
assert my_solution.countPalindromePaths(**test_input) == 5

test_input = { "parent": [-1,5,3,0,3,0], "s": "ltdewr" }
assert my_solution.countPalindromePaths(**test_input) == 5

test_input = { "parent": [-1,0,4,5,0,1], "s": "gjwwjv" }
assert my_solution.countPalindromePaths(**test_input) == 9

test_input = { "parent": [-1,7,7,0,8,2,2,4,3,8], "s": "cnssgsoogy" }
assert my_solution.countPalindromePaths(**test_input) == 20

test_input = { "parent": [-1,7,1,6,0,0,7,0], "s": "zaceoxax" }
assert my_solution.countPalindromePaths(**test_input) == 13

test_input = { "parent": [-1,0,1,0,3,0], "s": "zrvyyc" }
assert my_solution.countPalindromePaths(**test_input) == 8

test_input = { "parent": [-1,4,9,0,3,3,7,4,2,0], "s": "qxixxxxxix" }
assert my_solution.countPalindromePaths(**test_input) == 41

test_input = { "parent": [-1,2,0,5,5,2,5], "s": "hoptvuu" }
assert my_solution.countPalindromePaths(**test_input) == 9

test_input = { "parent": [-1,7,3,0,3,1,0,3], "s": "kopflpao" }
assert my_solution.countPalindromePaths(**test_input) == 13

test_input = { "parent": [-1,0,1,6,1,1,1], "s": "bhhslhl" }
assert my_solution.countPalindromePaths(**test_input) == 11

test_input = { "parent": [-1,0,0,1,2], "s": "khhch" }
assert my_solution.countPalindromePaths(**test_input) == 8

test_input = { "parent": [-1,0,3,0], "s": "koss" }
assert my_solution.countPalindromePaths(**test_input) == 5

test_input = { "parent": [-1,3,4,4,0], "s": "owzoq" }
assert my_solution.countPalindromePaths(**test_input) == 4

test_input = { "parent": [-1,2,0,1,1], "s": "zqqww" }
assert my_solution.countPalindromePaths(**test_input) == 8

test_input = { "parent": [-1,0,1,1,1,2,2], "s": "lacccdb" }
assert my_solution.countPalindromePaths(**test_input) == 13

test_input = { "parent": [-1,4,3,4,6,6,7,0,6], "s": "sjoooorrm" }
assert my_solution.countPalindromePaths(**test_input) == 24

test_input = { "parent": [-1,7,4,2,0,6,2,3,7], "s": "guqyxxtau" }
assert my_solution.countPalindromePaths(**test_input) == 9

test_input = { "parent": [-1,4,4,0,0], "s": "scicc" }
assert my_solution.countPalindromePaths(**test_input) == 8

test_input = { "parent": [-1,5,8,6,3,0,2,3,1], "s": "naphhahhp" }
assert my_solution.countPalindromePaths(**test_input) == 29

test_input = { "parent": [-1,3,8,8,5,0,4,0,0,2], "s": "ciiyggofij" }
assert my_solution.countPalindromePaths(**test_input) == 23

test_input = { "parent": [-1,2,0,2,2,3,7,8,4,2], "s": "stthtthddt" }
assert my_solution.countPalindromePaths(**test_input) == 34

test_input = { "parent": [-1,2,0,7,3,7,4,0], "s": "mjjsjdsj" }
assert my_solution.countPalindromePaths(**test_input) == 18

test_input = { "parent": [-1,0], "s": "ey" }
assert my_solution.countPalindromePaths(**test_input) == 1


check-if-array-is-good

Check if Array is Good

Prompt:
"""
You are given an integer array nums. We consider an array good if it is a permutation of an array base[n].

base[n] = [1, 2, ..., n - 1, n, n] (in other words, it is an array of length n + 1 which contains 1 to n - 1 exactly once, plus two occurrences of n). For example, base[1] = [1, 1] and base[3] = [1, 2, 3, 3].

Return true if the given array is good, otherwise return false.

Note: A permutation of integers represents an arrangement of these numbers.

Example 1:

Input: nums = [2, 1, 3]
Output: false
Explanation: Since the maximum element of the array is 3, the only candidate n for which this array could be a permutation of base[n], is n = 3. However, base[3] has four elements but array nums has three. Therefore, it can not be a permutation of base[3] = [1, 2, 3, 3]. So the answer is false.

Example 2:

Input: nums = [1, 3, 3, 2]
Output: true
Explanation: Since the maximum element of the array is 3, the only candidate n for which this array could be a permutation of base[n], is n = 3. It can be seen that nums is a permutation of base[3] = [1, 2, 3, 3] (by swapping the second and fourth elements in nums, we reach base[3]). Therefore, the answer is true.

Example 3:

Input: nums = [1, 1]
Output: true
Explanation: Since the maximum element of the array is 1, the only candidate n for which this array could be a permutation of base[n], is n = 1. It can be seen that nums is a permutation of base[1] = [1, 1]. Therefore, the answer is true.

Example 4:

Input: nums = [3, 4, 4, 1, 2, 1]
Output: false
Explanation: Since the maximum element of the array is 4, the only candidate n for which this array could be a permutation of base[n], is n = 4. However, base[4] has five elements but array nums has six. Therefore, it can not be a permutation of base[4] = [1, 2, 3, 4, 4]. So the answer is false.

Constraints:

 * 1 <= nums.length <= 100
 * 1 <= num[i] <= 200
"""
class Solution:
    def isGood(self, nums: List[int]) -> bool:

You are given an integer array nums. We consider an array good if it is a permutation of an array base[n].

base[n] = [1, 2, ..., n - 1, n, n] (in other words, it is an array of length n + 1 which contains 1 to n - 1 exactly once, plus two occurrences of n). For example, base[1] = [1, 1] and base[3] = [1, 2, 3, 3].

Return true if the given array is good, otherwise return false.

Note: A permutation of integers represents an arrangement of these numbers.

Example 1:

Input: nums = [2, 1, 3]
Output: false
Explanation: Since the maximum element of the array is 3, the only candidate n for which this array could be a permutation of base[n], is n = 3. However, base[3] has four elements but array nums has three. Therefore, it can not be a permutation of base[3] = [1, 2, 3, 3]. So the answer is false.

Example 2:

Input: nums = [1, 3, 3, 2]
Output: true
Explanation: Since the maximum element of the array is 3, the only candidate n for which this array could be a permutation of base[n], is n = 3. It can be seen that nums is a permutation of base[3] = [1, 2, 3, 3] (by swapping the second and fourth elements in nums, we reach base[3]). Therefore, the answer is true.

Example 3:

Input: nums = [1, 1]
Output: true
Explanation: Since the maximum element of the array is 1, the only candidate n for which this array could be a permutation of base[n], is n = 1. It can be seen that nums is a permutation of base[1] = [1, 1]. Therefore, the answer is true.

Example 4:

Input: nums = [3, 4, 4, 1, 2, 1]
Output: false
Explanation: Since the maximum element of the array is 4, the only candidate n for which this array could be a permutation of base[n], is n = 4. However, base[4] has five elements but array nums has six. Therefore, it can not be a permutation of base[4] = [1, 2, 3, 4, 4]. So the answer is false.

Constraints:

 * 1 <= nums.length <= 100
 * 1 <= num[i] <= 200

Please complete the code below to solve above prblem:
```python
class Solution:
    def isGood(self, nums: List[int]) -> bool:

```

my_solution = Solution()

test_input = { "nums": [1, 3, 3, 2] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [2, 1, 3] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [1, 1] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 2, 2] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [3, 4, 4, 1, 2, 1] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [2, 2, 1] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [2] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [3] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [3, 3, 1, 2] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 3, 4, 4, 2] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [4] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [1, 4, 2, 4, 3] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [5] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [4, 4, 1, 2, 3] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [6] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [4, 4, 2, 3, 1] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [8] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [9] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [5, 5, 1, 3, 2, 4] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 5, 3, 6, 6, 4, 2] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [5, 4, 6, 6, 3, 2, 1] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [10] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [6, 3, 6, 4, 2, 1, 5] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [6, 3, 6, 5, 1, 2, 4] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [12] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [7, 2, 5, 7, 3, 6, 1, 4] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 2, 8, 8, 6, 5, 4, 3, 7] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 8, 4, 8, 2, 7, 6, 3, 5] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [13] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [14] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [2, 8, 6, 1, 7, 5, 3, 4, 8] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [4, 1, 3, 2, 8, 5, 8, 6, 7] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [15] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [7, 2, 1, 5, 6, 8, 8, 4, 3] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [82] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [1, 8] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [8, 6, 2, 5, 7, 4, 1, 8, 3] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [4, 6, 1, 9, 8, 9, 5, 7, 3, 2] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 13] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [2, 3] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [9, 5, 8, 9, 6, 1, 2, 7, 4, 3] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 2, 10, 9, 10, 5, 6, 4, 8, 7, 3] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 9, 2, 6, 5, 4, 7, 10, 3, 10, 8] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [1, 10, 7, 8, 10, 4, 6, 3, 5, 2, 9] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [8, 2, 1, 4, 3, 10, 9, 5, 10, 7, 6] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [10, 9, 5, 3, 6, 4, 2, 10, 8, 7, 1] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [2, 9] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [1, 4, 5, 10, 11, 2, 9, 7, 6, 11, 3, 8] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [2, 11] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [11, 5, 9, 10, 3, 11, 1, 2, 8, 4, 7, 6] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [11, 9, 8, 1, 12, 4, 2, 15, 16, 10, 13, 6, 3, 16, 7, 5, 14] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [11, 16, 9, 5, 14, 13, 4, 1, 3, 16, 15, 8, 10, 7, 12, 2, 6] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [2, 12] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [17, 1, 18, 11, 9, 4, 7, 6, 3, 21, 16, 14, 10, 8, 20, 21, 5, 2, 12, 19, 15, 13] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [3, 1] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [20, 13, 7, 10, 16, 12, 19, 2, 21, 17, 3, 11, 5, 15, 21, 1, 18, 6, 8, 14, 9, 4] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [8, 19, 16, 17, 20, 15, 11, 4, 22, 3, 13, 10, 1, 18, 9, 12, 22, 7, 6, 2, 5, 21, 14] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [22, 1, 17, 13, 8, 22, 9, 5, 21, 6, 14, 12, 10, 11, 2, 18, 4, 7, 19, 20, 3, 15, 16] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [21, 15, 16, 13, 3, 4, 11, 22, 7, 14, 20, 10, 18, 17, 6, 8, 9, 1, 19, 5, 2, 12, 23, 24, 24] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [22, 24, 24, 12, 17, 15, 14, 16, 8, 11, 23, 5, 2, 10, 6, 21, 9, 13, 3, 20, 19, 7, 4, 18, 1] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [3, 2] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [6, 16, 26, 9, 4, 24, 12, 26, 22, 3, 11, 23, 15, 2, 17, 5, 1, 21, 14, 19, 18, 20, 13, 25, 8, 7, 10] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [29, 24, 5, 6, 4, 25, 9, 8, 21, 13, 27, 7, 20, 18, 3, 15, 23, 28, 29, 19, 17, 10, 22, 26, 1, 11, 12, 14, 16, 2] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [25, 21, 6, 10, 20, 15, 16, 26, 7, 3, 30, 1, 12, 29, 11, 30, 14, 19, 2, 28, 23, 9, 8, 24, 17, 5, 4, 27, 22, 18, 13] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [3, 11] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [2, 25, 20, 30, 4, 6, 1, 29, 15, 11, 10, 19, 14, 12, 32, 3, 21, 27, 16, 17, 28, 13, 5, 32, 8, 24, 22, 7, 31, 23, 18, 26, 9] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [4, 10] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [4, 12] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [5, 9] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [5, 12] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [5, 13] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [4, 29, 5, 24, 19, 1, 8, 31, 18, 21, 9, 28, 32, 27, 10, 17, 22, 2, 11, 15, 13, 23, 6, 16, 7, 30, 12, 33, 14, 25, 33, 26, 3, 20] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [6, 1] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [30, 32, 1, 35, 19, 34, 4, 23, 18, 6, 11, 8, 22, 33, 31, 16, 17, 20, 24, 10, 21, 7, 14, 15, 29, 9, 12, 2, 36, 3, 26, 36, 5, 13, 25, 27, 28] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [5, 34, 42, 17, 9, 44, 40, 24, 38, 21, 30, 14, 39, 11, 18, 36, 4, 43, 12, 32, 2, 6, 45, 46, 37, 47, 8, 3, 26, 1, 31, 28, 16, 20, 22, 35, 25, 15, 10, 29, 7, 27, 19, 33, 41, 47, 23, 13] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [6, 7] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [5, 41, 8, 2, 32, 24, 9, 44, 27, 6, 22, 36, 14, 21, 43, 28, 45, 37, 17, 18, 20, 26, 3, 12, 10, 33, 30, 13, 29, 38, 4, 47, 46, 15, 25, 11, 1, 19, 47, 16, 39, 31, 40, 34, 23, 7, 42, 35] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [6, 10] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [6, 12] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [6, 15] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [7, 9] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [8, 4] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [8, 6] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [26, 35, 9, 3, 46, 33, 13, 8, 47, 27, 17, 40, 15, 20, 37, 12, 16, 44, 34, 2, 14, 30, 1, 29, 10, 11, 25, 18, 43, 42, 6, 5, 47, 38, 41, 32, 24, 31, 7, 4, 45, 19, 39, 22, 28, 36, 21, 23] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [8, 9] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [8, 10] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [8, 13] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [32, 39, 25, 49, 6, 48, 9, 7, 34, 3, 8, 26, 14, 27, 43, 30, 1, 21, 36, 10, 31, 38, 40, 12, 2, 46, 20, 15, 11, 24, 22, 28, 33, 4, 19, 18, 44, 41, 35, 29, 16, 37, 45, 47, 49, 23, 42, 13, 5, 17] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [9, 7] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [18, 35, 44, 41, 8, 33, 28, 9, 3, 14, 43, 56, 6, 10, 25, 53, 61, 22, 17, 23, 32, 50, 31, 13, 1, 29, 45, 34, 30, 48, 36, 58, 46, 15, 4, 7, 52, 60, 16, 12, 54, 19, 24, 40, 26, 55, 49, 42, 21, 38, 2, 20, 57, 61, 5, 37, 47, 27, 39, 11, 51, 59] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [9, 9] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [10, 4] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [10, 11] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [11, 1] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [60, 62, 16, 59, 8, 49, 51, 41, 42, 40, 46, 3, 10, 13, 53, 2, 63, 54, 32, 33, 31, 14, 12, 15, 1, 66, 61, 18, 52, 4, 55, 11, 26, 28, 47, 21, 25, 43, 65, 58, 45, 50, 17, 64, 23, 22, 30, 9, 38, 19, 24, 44, 37, 39, 48, 20, 35, 36, 27, 34, 56, 57, 29, 5, 7, 6, 66] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [46, 9, 21, 14, 24, 15, 6, 58, 22, 40, 63, 39, 49, 65, 30, 5, 43, 36, 29, 55, 67, 45, 61, 35, 67, 56, 16, 23, 50, 17, 19, 13, 26, 66, 47, 59, 2, 51, 27, 28, 31, 1, 44, 42, 53, 57, 11, 25, 4, 54, 37, 20, 48, 52, 41, 32, 10, 7, 64, 34, 60, 12, 33, 38, 3, 18, 62, 8] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [11, 5] }
assert my_solution.isGood(**test_input) == False

test_input = { "nums": [57, 40, 35, 55, 42, 24, 43, 29, 30, 59, 21, 52, 67, 72, 32, 78, 13, 51, 36, 48, 74, 64, 69, 65, 9, 4, 37, 31, 6, 27, 7, 2, 38, 61, 15, 19, 71, 49, 44, 47, 46, 54, 76, 26, 63, 17, 22, 3, 16, 12, 18, 41, 25, 62, 8, 10, 23, 50, 56, 11, 20, 5, 28, 77, 66, 53, 14, 33, 68, 34, 73, 45, 1, 78, 39, 70, 75, 60, 58] }
assert my_solution.isGood(**test_input) == True

test_input = { "nums": [14, 38, 18, 10, 21, 9, 67, 68, 23, 19, 80, 13, 74, 75, 32, 55, 65, 45, 5, 28, 43, 8, 17, 42, 40, 44, 31, 1, 7, 25, 6, 47, 27, 50, 4, 76, 63, 52, 71, 34, 83, 56, 77, 81, 16, 12, 60, 79, 46, 41, 24, 35, 33, 2, 49, 70, 78, 36, 48, 69, 26, 66, 37, 72, 61, 30, 22, 58, 20, 39, 82, 64, 73, 59, 57, 3, 51, 29, 83, 53, 15, 54, 11, 62] }
assert my_solution.isGood(**test_input) == True


sort-vowels-in-a-string

Sort Vowels in a String

Prompt:
"""
Given a 0-indexed string s, permute s to get a new string t such that:

 * All consonants remain in their original places. More formally, if there is an index i with 0 <= i < s.length such that s[i] is a consonant, then t[i] = s[i].
 * The vowels must be sorted in the nondecreasing order of their ASCII values. More formally, for pairs of indices i, j with 0 <= i < j < s.length such that s[i] and s[j] are vowels, then t[i] must not have a higher ASCII value than t[j].

Return the resulting string.

The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in lowercase or uppercase. Consonants comprise all letters that are not vowels.

Example 1:

Input: s = "lEetcOde"
Output: "lEOtcede"
Explanation: 'E', 'O', and 'e' are the vowels in s; 'l', 't', 'c', and 'd' are all consonants. The vowels are sorted according to their ASCII values, and the consonants remain in the same places.

Example 2:

Input: s = "lYmpH"
Output: "lYmpH"
Explanation: There are no vowels in s (all characters in s are consonants), so we return "lYmpH".

Constraints:

 * 1 <= s.length <= 105
 * s consists only of letters of the English alphabet in uppercase and lowercase.
"""
class Solution:
    def sortVowels(self, s: str) -> str:

Given a 0-indexed string s, permute s to get a new string t such that:

 * All consonants remain in their original places. More formally, if there is an index i with 0 <= i < s.length such that s[i] is a consonant, then t[i] = s[i].
 * The vowels must be sorted in the nondecreasing order of their ASCII values. More formally, for pairs of indices i, j with 0 <= i < j < s.length such that s[i] and s[j] are vowels, then t[i] must not have a higher ASCII value than t[j].

Return the resulting string.

The vowels are 'a', 'e', 'i', 'o', and 'u', and they can appear in lowercase or uppercase. Consonants comprise all letters that are not vowels.

Example 1:

Input: s = "lEetcOde"
Output: "lEOtcede"
Explanation: 'E', 'O', and 'e' are the vowels in s; 'l', 't', 'c', and 'd' are all consonants. The vowels are sorted according to their ASCII values, and the consonants remain in the same places.

Example 2:

Input: s = "lYmpH"
Output: "lYmpH"
Explanation: There are no vowels in s (all characters in s are consonants), so we return "lYmpH".

Constraints:

 * 1 <= s.length <= 105
 * s consists only of letters of the English alphabet in uppercase and lowercase.

Please complete the code below to solve above prblem:
```python
class Solution:
    def sortVowels(self, s: str) -> str:

```

my_solution = Solution()

test_input = { "s": "lEetcOde" }
assert my_solution.sortVowels(**test_input) == "lEOtcede"

test_input = { "s": "lYmpH" }
assert my_solution.sortVowels(**test_input) == "lYmpH"

test_input = { "s": "mDVD" }
assert my_solution.sortVowels(**test_input) == "mDVD"

test_input = { "s": "xdX" }
assert my_solution.sortVowels(**test_input) == "xdX"

test_input = { "s": "xdE" }
assert my_solution.sortVowels(**test_input) == "xdE"

test_input = { "s": "RiQYo" }
assert my_solution.sortVowels(**test_input) == "RiQYo"

test_input = { "s": "LQRamBOHfq" }
assert my_solution.sortVowels(**test_input) == "LQROmBaHfq"

test_input = { "s": "UpjPbEnOj" }
assert my_solution.sortVowels(**test_input) == "EpjPbOnUj"

test_input = { "s": "ziF" }
assert my_solution.sortVowels(**test_input) == "ziF"

test_input = { "s": "WxkKdjhL" }
assert my_solution.sortVowels(**test_input) == "WxkKdjhL"

test_input = { "s": "uZcPmqAd" }
assert my_solution.sortVowels(**test_input) == "AZcPmqud"

test_input = { "s": "UjshJXjkjS" }
assert my_solution.sortVowels(**test_input) == "UjshJXjkjS"

test_input = { "s": "nElwWTQHJ" }
assert my_solution.sortVowels(**test_input) == "nElwWTQHJ"

test_input = { "s": "kwcJqvsgM" }
assert my_solution.sortVowels(**test_input) == "kwcJqvsgM"

test_input = { "s": "z" }
assert my_solution.sortVowels(**test_input) == "z"

test_input = { "s": "Pz" }
assert my_solution.sortVowels(**test_input) == "Pz"

test_input = { "s": "T" }
assert my_solution.sortVowels(**test_input) == "T"

test_input = { "s": "syRWvFi" }
assert my_solution.sortVowels(**test_input) == "syRWvFi"

test_input = { "s": "G" }
assert my_solution.sortVowels(**test_input) == "G"

test_input = { "s": "MuQYHVy" }
assert my_solution.sortVowels(**test_input) == "MuQYHVy"

test_input = { "s": "gsc" }
assert my_solution.sortVowels(**test_input) == "gsc"

test_input = { "s": "nynBd" }
assert my_solution.sortVowels(**test_input) == "nynBd"

test_input = { "s": "qUSUCJeJZt" }
assert my_solution.sortVowels(**test_input) == "qUSUCJeJZt"

test_input = { "s": "PoEvPD" }
assert my_solution.sortVowels(**test_input) == "PEovPD"

test_input = { "s": "SrSuArHDvA" }
assert my_solution.sortVowels(**test_input) == "SrSAArHDvu"

test_input = { "s": "zI" }
assert my_solution.sortVowels(**test_input) == "zI"

test_input = { "s": "zpVZt" }
assert my_solution.sortVowels(**test_input) == "zpVZt"

test_input = { "s": "dZVLG" }
assert my_solution.sortVowels(**test_input) == "dZVLG"

test_input = { "s": "EHhQZGJBbp" }
assert my_solution.sortVowels(**test_input) == "EHhQZGJBbp"

test_input = { "s": "aPLCji" }
assert my_solution.sortVowels(**test_input) == "aPLCji"

test_input = { "s": "HSe" }
assert my_solution.sortVowels(**test_input) == "HSe"

test_input = { "s": "HvDMPPU" }
assert my_solution.sortVowels(**test_input) == "HvDMPPU"

test_input = { "s": "LYACGrvJLZ" }
assert my_solution.sortVowels(**test_input) == "LYACGrvJLZ"

test_input = { "s": "RepLvwHFI" }
assert my_solution.sortVowels(**test_input) == "RIpLvwHFe"

test_input = { "s": "vjbObvLfs" }
assert my_solution.sortVowels(**test_input) == "vjbObvLfs"

test_input = { "s": "sKQwLo" }
assert my_solution.sortVowels(**test_input) == "sKQwLo"

test_input = { "s": "PoqU" }
assert my_solution.sortVowels(**test_input) == "PUqo"

test_input = { "s": "QgUxRvJTfH" }
assert my_solution.sortVowels(**test_input) == "QgUxRvJTfH"

test_input = { "s": "wUMnwnblpu" }
assert my_solution.sortVowels(**test_input) == "wUMnwnblpu"

test_input = { "s": "JpqXrPuMd" }
assert my_solution.sortVowels(**test_input) == "JpqXrPuMd"

test_input = { "s": "wdtDPSQdKl" }
assert my_solution.sortVowels(**test_input) == "wdtDPSQdKl"

test_input = { "s": "Dl" }
assert my_solution.sortVowels(**test_input) == "Dl"

test_input = { "s": "v" }
assert my_solution.sortVowels(**test_input) == "v"

test_input = { "s": "axRukCyOHm" }
assert my_solution.sortVowels(**test_input) == "OxRakCyuHm"

test_input = { "s": "sQyytiAh" }
assert my_solution.sortVowels(**test_input) == "sQyytAih"

test_input = { "s": "ieTwHeOR" }
assert my_solution.sortVowels(**test_input) == "OeTwHeiR"

test_input = { "s": "LLxyZ" }
assert my_solution.sortVowels(**test_input) == "LLxyZ"

test_input = { "s": "s" }
assert my_solution.sortVowels(**test_input) == "s"

test_input = { "s": "oefu" }
assert my_solution.sortVowels(**test_input) == "eofu"

test_input = { "s": "XV" }
assert my_solution.sortVowels(**test_input) == "XV"

test_input = { "s": "VkfjDpSH" }
assert my_solution.sortVowels(**test_input) == "VkfjDpSH"

test_input = { "s": "rg" }
assert my_solution.sortVowels(**test_input) == "rg"

test_input = { "s": "ecV" }
assert my_solution.sortVowels(**test_input) == "ecV"

test_input = { "s": "RUnxytMua" }
assert my_solution.sortVowels(**test_input) == "RUnxytMau"

test_input = { "s": "gUyMeyzOZo" }
assert my_solution.sortVowels(**test_input) == "gOyMUyzeZo"

test_input = { "s": "WEir" }
assert my_solution.sortVowels(**test_input) == "WEir"

test_input = { "s": "zZWs" }
assert my_solution.sortVowels(**test_input) == "zZWs"

test_input = { "s": "WULsDqIhp" }
assert my_solution.sortVowels(**test_input) == "WILsDqUhp"

test_input = { "s": "pw" }
assert my_solution.sortVowels(**test_input) == "pw"

test_input = { "s": "nOWxdSzo" }
assert my_solution.sortVowels(**test_input) == "nOWxdSzo"

test_input = { "s": "NfK" }
assert my_solution.sortVowels(**test_input) == "NfK"

test_input = { "s": "wXRFu" }
assert my_solution.sortVowels(**test_input) == "wXRFu"

test_input = { "s": "XXtjDoinAD" }
assert my_solution.sortVowels(**test_input) == "XXtjDAinoD"

test_input = { "s": "SGUzEv" }
assert my_solution.sortVowels(**test_input) == "SGEzUv"

test_input = { "s": "RFOvEt" }
assert my_solution.sortVowels(**test_input) == "RFEvOt"

test_input = { "s": "umQePdr" }
assert my_solution.sortVowels(**test_input) == "emQuPdr"

test_input = { "s": "wRqZ" }
assert my_solution.sortVowels(**test_input) == "wRqZ"

test_input = { "s": "blu" }
assert my_solution.sortVowels(**test_input) == "blu"

test_input = { "s": "QeOQEatFaW" }
assert my_solution.sortVowels(**test_input) == "QEOQaatFeW"

test_input = { "s": "jzWiXrYa" }
assert my_solution.sortVowels(**test_input) == "jzWaXrYi"

test_input = { "s": "xs" }
assert my_solution.sortVowels(**test_input) == "xs"

test_input = { "s": "DwROc" }
assert my_solution.sortVowels(**test_input) == "DwROc"

test_input = { "s": "XMhLlJd" }
assert my_solution.sortVowels(**test_input) == "XMhLlJd"

test_input = { "s": "uAmir" }
assert my_solution.sortVowels(**test_input) == "Aimur"

test_input = { "s": "PTlFpeAI" }
assert my_solution.sortVowels(**test_input) == "PTlFpAIe"

test_input = { "s": "XLYy" }
assert my_solution.sortVowels(**test_input) == "XLYy"

test_input = { "s": "vA" }
assert my_solution.sortVowels(**test_input) == "vA"

test_input = { "s": "y" }
assert my_solution.sortVowels(**test_input) == "y"

test_input = { "s": "C" }
assert my_solution.sortVowels(**test_input) == "C"

test_input = { "s": "wrnMlek" }
assert my_solution.sortVowels(**test_input) == "wrnMlek"

test_input = { "s": "JWbfCfGgf" }
assert my_solution.sortVowels(**test_input) == "JWbfCfGgf"

test_input = { "s": "OPGlnq" }
assert my_solution.sortVowels(**test_input) == "OPGlnq"

test_input = { "s": "DeOMW" }
assert my_solution.sortVowels(**test_input) == "DOeMW"

test_input = { "s": "xG" }
assert my_solution.sortVowels(**test_input) == "xG"

test_input = { "s": "ZcaBhfkWC" }
assert my_solution.sortVowels(**test_input) == "ZcaBhfkWC"

test_input = { "s": "pKa" }
assert my_solution.sortVowels(**test_input) == "pKa"

test_input = { "s": "DXSEKrfJCe" }
assert my_solution.sortVowels(**test_input) == "DXSEKrfJCe"

test_input = { "s": "xA" }
assert my_solution.sortVowels(**test_input) == "xA"

test_input = { "s": "Jb" }
assert my_solution.sortVowels(**test_input) == "Jb"

test_input = { "s": "SBQT" }
assert my_solution.sortVowels(**test_input) == "SBQT"

test_input = { "s": "LWRfYb" }
assert my_solution.sortVowels(**test_input) == "LWRfYb"

test_input = { "s": "tvLWAeGDFK" }
assert my_solution.sortVowels(**test_input) == "tvLWAeGDFK"

test_input = { "s": "jFkj" }
assert my_solution.sortVowels(**test_input) == "jFkj"

test_input = { "s": "zC" }
assert my_solution.sortVowels(**test_input) == "zC"

test_input = { "s": "ikYSsAveh" }
assert my_solution.sortVowels(**test_input) == "AkYSsevih"

test_input = { "s": "YXkS" }
assert my_solution.sortVowels(**test_input) == "YXkS"

test_input = { "s": "SOEo" }
assert my_solution.sortVowels(**test_input) == "SEOo"

test_input = { "s": "qoJx" }
assert my_solution.sortVowels(**test_input) == "qoJx"

test_input = { "s": "qGJbgTQ" }
assert my_solution.sortVowels(**test_input) == "qGJbgTQ"

test_input = { "s": "yiYYO" }
assert my_solution.sortVowels(**test_input) == "yOYYi"


visit-array-positions-to-maximize-score

Visit Array Positions to Maximize Score

Prompt:
"""
You are given a 0-indexed integer array nums and a positive integer x.

You are initially at position 0 in the array and you can visit other positions according to the following rules:

 * If you are currently in position i, then you can move to any position j such that i < j.
 * For each position i that you visit, you get a score of nums[i].
 * If you move from a position i to a position j and the parities of nums[i] and nums[j] differ, then you lose a score of x.

Return the maximum total score you can get.

Note that initially you have nums[0] points.

Example 1:

Input: nums = [2,3,6,1,9,2], x = 5
Output: 13
Explanation: We can visit the following positions in the array: 0 -> 2 -> 3 -> 4.
The corresponding values are 2, 6, 1 and 9. Since the integers 6 and 1 have different parities, the move 2 -> 3 will make you lose a score of x = 5.
The total score will be: 2 + 6 + 1 + 9 - 5 = 13.

Example 2:

Input: nums = [2,4,6,8], x = 3
Output: 20
Explanation: All the integers in the array have the same parities, so we can visit all of them without losing any score.
The total score is: 2 + 4 + 6 + 8 = 20.

Constraints:

 * 2 <= nums.length <= 105
 * 1 <= nums[i], x <= 106
"""
class Solution:
    def maxScore(self, nums: List[int], x: int) -> int:

You are given a 0-indexed integer array nums and a positive integer x.

You are initially at position 0 in the array and you can visit other positions according to the following rules:

 * If you are currently in position i, then you can move to any position j such that i < j.
 * For each position i that you visit, you get a score of nums[i].
 * If you move from a position i to a position j and the parities of nums[i] and nums[j] differ, then you lose a score of x.

Return the maximum total score you can get.

Note that initially you have nums[0] points.

Example 1:

Input: nums = [2,3,6,1,9,2], x = 5
Output: 13
Explanation: We can visit the following positions in the array: 0 -> 2 -> 3 -> 4.
The corresponding values are 2, 6, 1 and 9. Since the integers 6 and 1 have different parities, the move 2 -> 3 will make you lose a score of x = 5.
The total score will be: 2 + 6 + 1 + 9 - 5 = 13.

Example 2:

Input: nums = [2,4,6,8], x = 3
Output: 20
Explanation: All the integers in the array have the same parities, so we can visit all of them without losing any score.
The total score is: 2 + 4 + 6 + 8 = 20.

Constraints:

 * 2 <= nums.length <= 105
 * 1 <= nums[i], x <= 106

Please complete the code below to solve above prblem:
```python
class Solution:
    def maxScore(self, nums: List[int], x: int) -> int:

```


ways-to-express-an-integer-as-sum-of-powers

Ways to Express an Integer as Sum of Powers

Prompt:
"""
Given two positive integers n and x.

Return the number of ways n can be expressed as the sum of the xth power of unique positive integers, in other words, the number of sets of unique integers [n1, n2, ..., nk] where n = n1x + n2x + ... + nkx.

Since the result can be very large, return it modulo 109 + 7.

For example, if n = 160 and x = 3, one way to express n is n = 23 + 33 + 53.

Example 1:

Input: n = 10, x = 2
Output: 1
Explanation: We can express n as the following: n = 32 + 12 = 10.
It can be shown that it is the only way to express 10 as the sum of the 2nd power of unique integers.

Example 2:

Input: n = 4, x = 1
Output: 2
Explanation: We can express n in the following ways:
- n = 41 = 4.
- n = 31 + 11 = 4.

Constraints:

 * 1 <= n <= 300
 * 1 <= x <= 5
"""
class Solution:
    def numberOfWays(self, n: int, x: int) -> int:

Given two positive integers n and x.

Return the number of ways n can be expressed as the sum of the xth power of unique positive integers, in other words, the number of sets of unique integers [n1, n2, ..., nk] where n = n1x + n2x + ... + nkx.

Since the result can be very large, return it modulo 109 + 7.

For example, if n = 160 and x = 3, one way to express n is n = 23 + 33 + 53.

Example 1:

Input: n = 10, x = 2
Output: 1
Explanation: We can express n as the following: n = 32 + 12 = 10.
It can be shown that it is the only way to express 10 as the sum of the 2nd power of unique integers.

Example 2:

Input: n = 4, x = 1
Output: 2
Explanation: We can express n in the following ways:
- n = 41 = 4.
- n = 31 + 11 = 4.

Constraints:

 * 1 <= n <= 300
 * 1 <= x <= 5

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

```

my_solution = Solution()

test_input = { "n": 10, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 4, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 2

test_input = { "n": 1, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 1

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

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

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

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

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

test_input = { "n": 2, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 2, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 2, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 2, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

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

test_input = { "n": 3, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 3, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 3, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 3, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 4, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 4, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 4, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 4, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 5, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 3

test_input = { "n": 5, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 5, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 5, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 5, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 6, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 4

test_input = { "n": 6, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 6, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 6, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 6, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 7, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 5

test_input = { "n": 7, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 7, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 7, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 7, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 8, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 6

test_input = { "n": 8, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 8, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 8, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 8, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 9, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 8

test_input = { "n": 9, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 9, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 9, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 9, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

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

test_input = { "n": 10, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 10, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 10, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 11, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 12

test_input = { "n": 11, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 11, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 11, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 11, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 12, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 15

test_input = { "n": 12, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 12, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 12, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 12, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 13, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 18

test_input = { "n": 13, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 13, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 13, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 13, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 14, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 22

test_input = { "n": 14, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 14, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 14, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 14, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 15, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 27

test_input = { "n": 15, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 15, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 15, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 15, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 16, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 32

test_input = { "n": 16, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 16, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 16, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 16, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 17, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 38

test_input = { "n": 17, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 17, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 17, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 17, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 18, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 46

test_input = { "n": 18, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 18, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 18, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 18, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 19, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 54

test_input = { "n": 19, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 19, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 19, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 19, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 20, "x": 1 }
assert my_solution.numberOfWays(**test_input) == 64

test_input = { "n": 20, "x": 2 }
assert my_solution.numberOfWays(**test_input) == 1

test_input = { "n": 20, "x": 3 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 20, "x": 4 }
assert my_solution.numberOfWays(**test_input) == 0

test_input = { "n": 20, "x": 5 }
assert my_solution.numberOfWays(**test_input) == 0


sum-of-squares-of-special-elements

Sum of Squares of Special Elements

Prompt:
"""
You are given a 1-indexed integer array nums of length n.

An element nums[i] of nums is called special if i divides n, i.e. n % i == 0.

Return the sum of the squares of all special elements of nums.

Example 1:

Input: nums = [1,2,3,4]
Output: 21
Explanation: There are exactly 3 special elements in nums: nums[1] since 1 divides 4, nums[2] since 2 divides 4, and nums[4] since 4 divides 4.
Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[4] * nums[4] = 1 * 1 + 2 * 2 + 4 * 4 = 21.

Example 2:

Input: nums = [2,7,1,19,18,3]
Output: 63
Explanation: There are exactly 4 special elements in nums: nums[1] since 1 divides 6, nums[2] since 2 divides 6, nums[3] since 3 divides 6, and nums[6] since 6 divides 6.
Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[3] * nums[3] + nums[6] * nums[6] = 2 * 2 + 7 * 7 + 1 * 1 + 3 * 3 = 63.

Constraints:

 * 1 <= nums.length == n <= 50
 * 1 <= nums[i] <= 50
"""
class Solution:
    def sumOfSquares(self, nums: List[int]) -> int:

You are given a 1-indexed integer array nums of length n.

An element nums[i] of nums is called special if i divides n, i.e. n % i == 0.

Return the sum of the squares of all special elements of nums.

Example 1:

Input: nums = [1,2,3,4]
Output: 21
Explanation: There are exactly 3 special elements in nums: nums[1] since 1 divides 4, nums[2] since 2 divides 4, and nums[4] since 4 divides 4.
Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[4] * nums[4] = 1 * 1 + 2 * 2 + 4 * 4 = 21.

Example 2:

Input: nums = [2,7,1,19,18,3]
Output: 63
Explanation: There are exactly 4 special elements in nums: nums[1] since 1 divides 6, nums[2] since 2 divides 6, nums[3] since 3 divides 6, and nums[6] since 6 divides 6.
Hence, the sum of the squares of all special elements of nums is nums[1] * nums[1] + nums[2] * nums[2] + nums[3] * nums[3] + nums[6] * nums[6] = 2 * 2 + 7 * 7 + 1 * 1 + 3 * 3 = 63.

Constraints:

 * 1 <= nums.length == n <= 50
 * 1 <= nums[i] <= 50

Please complete the code below to solve above prblem:
```python
class Solution:
    def sumOfSquares(self, nums: List[int]) -> int:

```

my_solution = Solution()

test_input = { "nums": [1,2,3,4] }
assert my_solution.sumOfSquares(**test_input) == 21

test_input = { "nums": [2,7,1,19,18,3] }
assert my_solution.sumOfSquares(**test_input) == 63

test_input = { "nums": [1] }
assert my_solution.sumOfSquares(**test_input) == 1

test_input = { "nums": [2] }
assert my_solution.sumOfSquares(**test_input) == 4

test_input = { "nums": [3] }
assert my_solution.sumOfSquares(**test_input) == 9

test_input = { "nums": [4] }
assert my_solution.sumOfSquares(**test_input) == 16

test_input = { "nums": [5] }
assert my_solution.sumOfSquares(**test_input) == 25

test_input = { "nums": [6] }
assert my_solution.sumOfSquares(**test_input) == 36

test_input = { "nums": [7] }
assert my_solution.sumOfSquares(**test_input) == 49

test_input = { "nums": [8] }
assert my_solution.sumOfSquares(**test_input) == 64

test_input = { "nums": [9] }
assert my_solution.sumOfSquares(**test_input) == 81

test_input = { "nums": [10] }
assert my_solution.sumOfSquares(**test_input) == 100

test_input = { "nums": [11] }
assert my_solution.sumOfSquares(**test_input) == 121

test_input = { "nums": [12] }
assert my_solution.sumOfSquares(**test_input) == 144

test_input = { "nums": [13] }
assert my_solution.sumOfSquares(**test_input) == 169

test_input = { "nums": [14] }
assert my_solution.sumOfSquares(**test_input) == 196

test_input = { "nums": [15] }
assert my_solution.sumOfSquares(**test_input) == 225

test_input = { "nums": [16] }
assert my_solution.sumOfSquares(**test_input) == 256

test_input = { "nums": [17] }
assert my_solution.sumOfSquares(**test_input) == 289

test_input = { "nums": [18] }
assert my_solution.sumOfSquares(**test_input) == 324

test_input = { "nums": [19] }
assert my_solution.sumOfSquares(**test_input) == 361

test_input = { "nums": [20] }
assert my_solution.sumOfSquares(**test_input) == 400

test_input = { "nums": [21] }
assert my_solution.sumOfSquares(**test_input) == 441

test_input = { "nums": [22] }
assert my_solution.sumOfSquares(**test_input) == 484

test_input = { "nums": [23] }
assert my_solution.sumOfSquares(**test_input) == 529

test_input = { "nums": [24] }
assert my_solution.sumOfSquares(**test_input) == 576

test_input = { "nums": [25] }
assert my_solution.sumOfSquares(**test_input) == 625

test_input = { "nums": [26] }
assert my_solution.sumOfSquares(**test_input) == 676

test_input = { "nums": [27] }
assert my_solution.sumOfSquares(**test_input) == 729

test_input = { "nums": [28] }
assert my_solution.sumOfSquares(**test_input) == 784

test_input = { "nums": [29] }
assert my_solution.sumOfSquares(**test_input) == 841

test_input = { "nums": [30] }
assert my_solution.sumOfSquares(**test_input) == 900

test_input = { "nums": [31] }
assert my_solution.sumOfSquares(**test_input) == 961

test_input = { "nums": [32] }
assert my_solution.sumOfSquares(**test_input) == 1024

test_input = { "nums": [33] }
assert my_solution.sumOfSquares(**test_input) == 1089

test_input = { "nums": [34] }
assert my_solution.sumOfSquares(**test_input) == 1156

test_input = { "nums": [35] }
assert my_solution.sumOfSquares(**test_input) == 1225

test_input = { "nums": [36] }
assert my_solution.sumOfSquares(**test_input) == 1296

test_input = { "nums": [37] }
assert my_solution.sumOfSquares(**test_input) == 1369

test_input = { "nums": [38] }
assert my_solution.sumOfSquares(**test_input) == 1444

test_input = { "nums": [39] }
assert my_solution.sumOfSquares(**test_input) == 1521

test_input = { "nums": [40] }
assert my_solution.sumOfSquares(**test_input) == 1600

test_input = { "nums": [41] }
assert my_solution.sumOfSquares(**test_input) == 1681

test_input = { "nums": [42] }
assert my_solution.sumOfSquares(**test_input) == 1764

test_input = { "nums": [43] }
assert my_solution.sumOfSquares(**test_input) == 1849

test_input = { "nums": [44] }
assert my_solution.sumOfSquares(**test_input) == 1936

test_input = { "nums": [45] }
assert my_solution.sumOfSquares(**test_input) == 2025

test_input = { "nums": [46] }
assert my_solution.sumOfSquares(**test_input) == 2116

test_input = { "nums": [47] }
assert my_solution.sumOfSquares(**test_input) == 2209

test_input = { "nums": [48] }
assert my_solution.sumOfSquares(**test_input) == 2304

test_input = { "nums": [49] }
assert my_solution.sumOfSquares(**test_input) == 2401

test_input = { "nums": [50] }
assert my_solution.sumOfSquares(**test_input) == 2500

test_input = { "nums": [16,16] }
assert my_solution.sumOfSquares(**test_input) == 512

test_input = { "nums": [13,36] }
assert my_solution.sumOfSquares(**test_input) == 1465

test_input = { "nums": [40,37] }
assert my_solution.sumOfSquares(**test_input) == 2969

test_input = { "nums": [33,42] }
assert my_solution.sumOfSquares(**test_input) == 2853

test_input = { "nums": [46,9] }
assert my_solution.sumOfSquares(**test_input) == 2197

test_input = { "nums": [30,14] }
assert my_solution.sumOfSquares(**test_input) == 1096

test_input = { "nums": [5,41] }
assert my_solution.sumOfSquares(**test_input) == 1706

test_input = { "nums": [17,9] }
assert my_solution.sumOfSquares(**test_input) == 370

test_input = { "nums": [29,21] }
assert my_solution.sumOfSquares(**test_input) == 1282

test_input = { "nums": [4,38] }
assert my_solution.sumOfSquares(**test_input) == 1460

test_input = { "nums": [14,18] }
assert my_solution.sumOfSquares(**test_input) == 520

test_input = { "nums": [11,7] }
assert my_solution.sumOfSquares(**test_input) == 170

test_input = { "nums": [11,36] }
assert my_solution.sumOfSquares(**test_input) == 1417

test_input = { "nums": [18,26] }
assert my_solution.sumOfSquares(**test_input) == 1000

test_input = { "nums": [37,46] }
assert my_solution.sumOfSquares(**test_input) == 3485

test_input = { "nums": [13,33] }
assert my_solution.sumOfSquares(**test_input) == 1258

test_input = { "nums": [39,1] }
assert my_solution.sumOfSquares(**test_input) == 1522

test_input = { "nums": [37,16] }
assert my_solution.sumOfSquares(**test_input) == 1625

test_input = { "nums": [22,34] }
assert my_solution.sumOfSquares(**test_input) == 1640

test_input = { "nums": [4,50] }
assert my_solution.sumOfSquares(**test_input) == 2516

test_input = { "nums": [42,40] }
assert my_solution.sumOfSquares(**test_input) == 3364

test_input = { "nums": [7,44] }
assert my_solution.sumOfSquares(**test_input) == 1985

test_input = { "nums": [21,27] }
assert my_solution.sumOfSquares(**test_input) == 1170

test_input = { "nums": [49,35] }
assert my_solution.sumOfSquares(**test_input) == 3626

test_input = { "nums": [32,20] }
assert my_solution.sumOfSquares(**test_input) == 1424

test_input = { "nums": [30,12] }
assert my_solution.sumOfSquares(**test_input) == 1044

test_input = { "nums": [50,42] }
assert my_solution.sumOfSquares(**test_input) == 4264

test_input = { "nums": [3,11] }
assert my_solution.sumOfSquares(**test_input) == 130

test_input = { "nums": [38,17] }
assert my_solution.sumOfSquares(**test_input) == 1733

test_input = { "nums": [50,32] }
assert my_solution.sumOfSquares(**test_input) == 3524

test_input = { "nums": [12,35] }
assert my_solution.sumOfSquares(**test_input) == 1369

test_input = { "nums": [9,32] }
assert my_solution.sumOfSquares(**test_input) == 1105

test_input = { "nums": [6,11] }
assert my_solution.sumOfSquares(**test_input) == 157

test_input = { "nums": [11,39] }
assert my_solution.sumOfSquares(**test_input) == 1642

test_input = { "nums": [18,29] }
assert my_solution.sumOfSquares(**test_input) == 1165

test_input = { "nums": [44,29] }
assert my_solution.sumOfSquares(**test_input) == 2777

test_input = { "nums": [50,13] }
assert my_solution.sumOfSquares(**test_input) == 2669

test_input = { "nums": [46,46] }
assert my_solution.sumOfSquares(**test_input) == 4232

test_input = { "nums": [27,5] }
assert my_solution.sumOfSquares(**test_input) == 754

test_input = { "nums": [12,13] }
assert my_solution.sumOfSquares(**test_input) == 313

test_input = { "nums": [10,46] }
assert my_solution.sumOfSquares(**test_input) == 2216

test_input = { "nums": [37,32] }
assert my_solution.sumOfSquares(**test_input) == 2393

test_input = { "nums": [26,33] }
assert my_solution.sumOfSquares(**test_input) == 1765

test_input = { "nums": [44,3] }
assert my_solution.sumOfSquares(**test_input) == 1945

test_input = { "nums": [9,16] }
assert my_solution.sumOfSquares(**test_input) == 337

test_input = { "nums": [7,21] }
assert my_solution.sumOfSquares(**test_input) == 490

test_input = { "nums": [23,33] }
assert my_solution.sumOfSquares(**test_input) == 1618

test_input = { "nums": [22,5] }
assert my_solution.sumOfSquares(**test_input) == 509