[Mš Challenge] Number Squeezer š¤š¢š¤
Monday Blue š Challenge Series #12 Let's have some exercises this week! This time we will squeeze a number list from both directions until we get a single integer sum. š¼ TASK Write a program to accept a number list and display the output for each iteration of the squeezing operation with following conditions:- āļø The outermost integers from left and right will be squeezed and sum together after each iteration āļø When the number list have less than 4 elements, the next iteration will produce a single sum and the process stops. š§ TEST CASE [ 1 ] ā” 1 [ 1, 2 ] ā” 3 [ 1, 2, 3 ] ā” 6 [ 1, 2, 3, 4] ā” 3, 7 10 [ 1, 2, 3, 4, 5 ] ā” 3, 3, 9 15 [ 1, 2, 3, 4, 5, 6 ] ā” 3, 3, 4, 11 6, 15 21 [ 1, 2, 3, 4, 5, 6, 7 ] ā” 3, 3, 4, 5, 13 6, 4, 18 28 ā EXTRA Accept an additional integer which determines the squeeze factor that indicate the numbers to be compressed for each iteration. The examples shown above have a squeeze factor of 2. Besides, it's easy to observe that the iteration will stop if the number list consists of less than {2 Ć squeeze factor} numbers. ā¤ BONUS Clear-cut and optimized approach is encouraged. š SPECIAL MENTION (Visualization) https://code.sololearn.com/W4VaTH2ARO4J/?ref=app Happy Coding!!! šš»