Coding

Can you write a function that transforms an array into another where each element is the product of its two subsequent elements?

Frontend Engineer

Apple

Roblox

Zynga

Tech Mahindra

WeWork

Accenture

Did you come across this question in an interview?

  • Can you write a function that transforms an array into another where each element is the product of its two subsequent elements?
  • How would you approach writing a program that converts an array into a new one, where each value is the product of the next two values?
  • Could you devise a method to generate a new array from a given one, where each element represents the product of its two successors?
  • What's your strategy for creating a new array from an existing one, where each entry is the multiplication result of the following two elements?
  • How can you manipulate an array so that it becomes a new array with each element being the product of the two subsequent elements?
  • Can you develop a solution to transform an array into another, where each value is replaced by the product of the next two values in the sequence?
  • How do you plan to modify an array so that each element becomes the product of the next two elements in the array?
  • Could you create a function that alters an array to a new form, where each entry is the product of its two immediate successors?
  • Would you be able to engineer a process to convert an array into another, where each element is the multiplication of the next two items in the original array?
  • Given an array, return an array where each value is the product of the next two items: E.g. [3, 4, 5] -> [20, 15, 12]

Interview question asked to Frontend Engineers interviewing at Apple, WeWork, Daybreak Game Company and others: Can you write a function that transforms an array into another where each element is the product of its two subsequent elements?.