Amazon | Phone | Sliding Window Maximum
Anonymous User
3194

It was a nice interview with a very nice interviewer.

1: Short introduction
2: No LP part: WTF?
3 Tech part - 45 - 50 min.

Question 1;
Given an array of users login check-in/check-out find out if the users has checked-in then checkout.

Example 1:

Input: [1, 2, 2]
Output: false
Explanation: User 1 did not checkout

Example 2:

Input: [1, 2, 1, 2]
Output: true

Example 3:

Input: [1, 1, 2, 3, 3, 2, 1]
Output: false

Solution: HasMap then improve to use Set.


Question 2:
http://leetcode.com/problems/sliding-window-maximum/ -> Brute force approach

Follow-up:
Improve the problem sliding-window-maximum to be generic; Ex: Maximum, Minimum, Product, Diff of sliding window, So I came out with a template design pattern solution then he asked me to implement it.

I hope to get positive feedback. Last year I failed on onsite interview this time I'll rock it.

Obs: The discussion about Amazon interview process helps me a lot, thanks guys for sharing.

Comments (4)