Question: Create a function that read a integer list that contains set of positive and negative numbers of size 'N'. The maximum length of each element
Create a function that read a integer list that contains set of positive and negative numbers of size 'N'. The maximum length of each element in a set is based on list size "N". For example if the list size is '6' then the maximum length of each element is "6". Example list of elements is [-343, 2324 345543,-56554, 564, 36733). The list elements must be read as integer not as characters. Must create a user defined function to perform the following operations. The sum between each element in list will be calculated based on the same length of each element that matches with other elements: ARJEK For the above example in the list the length of each elements is: Fint to 1.-343 length is '3', 2324 length is '4', 345543 length is '6, -56554 length is '5', 564 length is 3' and 36733 length is '5' Hence the sum is calculated as follows: 2.-343+564=221 //Both numbers having same length 3 3.-56554 +36733=-19821 //Both numbers having same length '5' 4. 2324 = 4232 (since the length is '4' and it is not matched with any other elements in the list it should be stored in reversed order). 5. 345543-345543 6. 345543=345 (since the length is '6' and it is not matched with any other elements in the list, it should be stored in reversed order & it is also a palindrome, hence remove the repeated digits in the secondary part of the palindrome(highlighted in BOLD) recursively until no palindrome is presents) 7. In the first round the list is [221, -19821,4232,345) 8. Use steps 1-6 recursively, until the length of the digit is not some in the list. le 221 length is 319821 length is 5' 4232 length is A and 345 length is 13), since the first 6. 345543345 (since the length is and it is not matched with any other elements in the list, it should be stored in reversed order & it is also a palindrome, hence remove the repeated digits in the secondary part of the palindrome highlighted in BOLD) recursively until no palindrome is presents) 7. In the first round the list is [221 -198214232,345) B. Use steps 1-6 recursively, until the length of the digit is not same in the list le 221 length is '3, 19821 length is 5, 4232 length is '4' and 345 length is '3, since the first and fast elements are having same length then sum both: 221-345-566; length is 3 -19821-12891 (reversed); length is 5 4232 2324 (reversedi; length is 4 9. The ist elements are now 1566, -128912324). refer no elements are in the same length 10. Then create a function to convert the above elements as positive numbers to negative numbers and vice-versa, le After the conversion the list elements are -566, 12891-2324) & Finally arrange the list elements according to the increasing order of elements length irrespective of sign (+, or 11. The final output would be for the above example-566-2324, 128911, Examples Input: 6 size of an dynamic array -343 2324 345543 58554 564 36733 The Output: 1-566-2324128911
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
