amazon logo
Amazon· SDE II

Amazon Interview Question : SDE2

Posted
18 Sept 2025
323 reads

Summary

I encountered a specific data structure problem during my SDE2 interview at Amazon, where I was tasked with adjusting custom random pointers in a linked list.

How it went

During my SDE2 interview at Amazon, I faced an interesting challenge involving linked lists. The problem presented a custom node structure with both next and random pointers. The main task was to manipulate the random pointer of each node, making it point to the node containing the next larger numerical value within the entire list. This required careful traversal and logic to identify the appropriate target for each random pointer.

Questions asked (1)

  1. 01

    Random Pointer to Next Larger Node in Linked List

    Data Structures & Algorithms

    You are given a linked list where each node has two pointers: next and random. The next pointer points to the subsequent node in the list. The task is to modify the random pointer of each node to point to the node that contains the next larger numerical value in the list.

    For example, given the list: 110 --> 16 --> 114 --> 13 --> 18 --> 11, the random pointer of node 110 should point to 114 (as 114 is the next larger value after 110 in the list).

    110   -->   16  -->  114  -->  13 --> 18 -->    11
    |  \       / |               / |     / |       / |
    ->--->---/  -->---->-->---/  |-->-/  |-->---/  |
    \                                           |
    -----<-----------<-----------<-------------
    

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Amazon 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!