You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add a value to the middle of your array without the stock method
Challenge Description
Write a function called insertShiftArray which takes in an array and the value to be added. Without utilizing any of the built-in methods available to your language, return an array with the new value added at the middle index.
Approach & Efficiency
Approach
Count the elements in the array
Divide by 2 and round up if the total was odd
Iterate over the array, assigning them to the new array around the middle empty index
Assign the given value to the empty middle empty index