Katkat

Solve common string and subarray problems

LinkedInSoftware Engineer · Technical Screen

Last updated

Assesses core string and array manipulation skills by requiring string reversal and contiguous-subarray computations for maximum sum and maximum product, identified under the Coding & Algorithms category.

You are given three coding tasks:

  1. Reverse a string
  • Input: a string s.
  • Output: the string with characters in reverse order.
  1. Maximum sum of a contiguous subarray
  • Input: an integer array nums (may contain negative numbers).
  • Output: the maximum possible sum of any non-empty contiguous subarray.
  • Example: [-2,1,-3,4,-1,2,1,-5,4] → 6 (subarray [4,-1,2,1]).
  1. Maximum product of a contiguous subarray
  • Input: an integer array nums (may contain negative numbers and zeros).
  • Output: the maximum possible product of any non-empty contiguous subarray.
  • Example: [2,3,-2,4] → 6 (subarray [2,3]).