Question: This is a hacker rank challenge and has multiple test cases at runtime which remains anonymous so please ensure your code can produce the correct
This is a hacker rank challenge and has multiple test cases at runtime which remains anonymous so please ensure your code can produce the correct output over all the applicable arguments. also, you're required to only complete the function as the rest of the code is provided.


Spirinkle: Toppings HHackerRank It's Ms. Sugar's Birthday and she would like to celebrate it by having a special promotion at her famous pastry store in the city. She bought this 'Spirinkle' machine that she thinks would be great for the event. Each customer would order pastry topped with a custom-sized square spiral of sprinkles (a 'spirinkle'). All she has to do is place the pastry under the machine and enter the customer-supplied integer, k, on its dashboard. The machine would then draw a square spiral of sprinkles onto the pastry It does this by dropping the sprinkles on the pastry, one at a time, in a continuous path. It starts by depositing k sprinkles in a straight line. It then turns right 90 degrees and deposits k-2 sprinkles in a straight line. It repeats the process of turning 90 degrees and depositing two fewer sprinkles after each turn, until the last sprinkle is deposited, at which point it halts. For a given set of n customer orders, each an integer ki, determine the total number of sprinkles that the machine would deposit. Input Format Two lines. The first contains a single integer: n (indicating number of customers) The second contains n space separated integers denoting h, k2, , kn Constraints 1 S n
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
