[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!!! 😁💻