Community

Discussion Board

Anonymous interview experiences, offers and career talk from frontend engineers.

anon_859815

Amazon - SWE interview

#amazon
03400

Amazon · Software Engineer

Rounds

  1. Coding round

Questions asked

  • Given an integer array values and integer k, maximize occurrences of k.
  • For any subarray, you can add or subtract the same value to all elements in the subarray (the value applies to all elements in the subarray).
  • You can only add or subtract by a value in one subarray. Maximize occurrences of k.

Tips

  • Think about how changing a subarray can align its values to k, and how to choose the optimal subarray.
  • Try to use prefix sums to efficiently calculate the effect of changing different subarrays.

No replies yet

Markdown supported. 20 more characters needed.