Two coding questions were part of the OA.
Question1 :
Given a singly linkedlist like:
1->4->3->2
You have to calculate the sum of first and last elements like:
1+2 = 3
4+3 = 7
Then output the maximum sum. Here maximum sum is 7.
Space complexity should be O(1).
No constraint on time complexity.
Hint : discussed here :https://leetcode.com/discuss/interview-question/1546673/Amazon-or-OA-or-LinkedListSum
Question2 :
Given an array "points" of numbers, a score can be calculated for a subarray [i....j] by...
score = min(points[i...j])*sum(points[i...j[)
return the sum of all scores of all possible subarrays.
For example, points = [2,1,3]
in the form index pair = score
0,0 = 4
0,1 = 3
0,2 = 6
1,1 = 1
1,2 = 4
2,2 = 9
total = 25
Solution : discussed here :https://leetcode.com/discuss/interview-question/1736639/solution-to-amazon-oa-2022-problem-sum-of-scores-of-subarray/1255065