← Questions

Sum of products over all subarrays

0
PikaCodingLast asked Aug 2025

An online assessment with two problems.

  1. A simplified text justification: lay words out into lines of a fixed width.
  2. Given an array, return the sum, over every contiguous subarray, of the product of its elements. Do it in one pass by keeping the sum of products of subarrays that end at the current index.
Write and test your solution herePython in your browser, the question's tests level by level, saved for you.Sign in to start coding