This is a question needs pay for , I have no money to pay ,so just write some test case by myself. If you read this blog , and you hava pay for the LeetCode ,and you have test my program , please tell me that wheather is works, thank you. This idea i…