agoda logo
Agoda· Staff Software Engineer - Back End

Staff SE - Back End | Pair Coding Round | Agoda

Posted
8 Jun 2026
143 reads

Summary

I took part in a pair coding round at Agoda for a Staff Backend Software Engineer position, where I was asked two algorithmic questions.

How it went

Hi Folks,

Number of Questions: 2

I was asked the following two questions in a recent coding interview. I dont remember the exact input/output examples for both the problems, but the problem statements were roughly as follows:

Q1: Given an array, find all pairs of elements whose difference is equal to the minimum absolute difference in array. input = [1,3,10,7,5] output = [[1,3], [5,7]] (as minimum absolute diff in any 2 elemnents of array is 2)

Q2: Given an array, for each element, find the distance (gap/index difference) to the next smaller element on its right. This problem can be solved using monotonic stack.

Questions asked (2)

  1. 01

    Find All Pairs with Minimum Absolute Difference

    Data Structures & Algorithms

    Given an array, find all pairs of elements whose difference is equal to the minimum absolute difference in the array.

    Example

    input = [1,3,10,7,5]
    output = [[1,3], [5,7]]
    

    The output contains all pairs whose absolute difference equals the smallest possible absolute difference among any two elements in the array (which is 2 in the example).

  2. 02

    Next Smaller Element Distance to the Right

    Data Structures & Algorithms

    Given an array, for each element find the distance (index gap) to the next smaller element on its right.

    Hint: This problem can be solved using a monotonic stack.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Agoda recently?

Write up your rounds while you still remember the questions. It helps the next person more than you would think.

Share your experience
Discussion 0

Questions for the author, or how your own interview compared.

Join the discussion

Sign in with Google to comment or ask the author a question.

No comments yet

Be the first to share your thoughts and start the discussion!