glovo logo
Glovo· software engineer 2

Glovo || software engineer 2 || barcelona

Location
barcelona
Posted
28 Nov 2025
323 reads

Summary

I participated in a live coding round for a Software Engineer 2 role at Glovo in Barcelona, where I was tasked with solving a complex data structure design problem involving dinner plate stacks.

How it went

I had a live coding round for the Software Engineer 2 position at Glovo in Barcelona. The problem presented was 'Dinner Plate Stacks', which required me to design and implement a data structure to manage stacks of plates with specific push, pop, and popAtStack operations. The round focused on providing a working solution with test cases, and I concentrated on the logic and implementation details for each method, considering the constraints and edge cases.

Questions asked (1)

  1. 01

    Dinner Plate Stacks

    Data Structures & Algorithms

    Problem Description

    • Design and implement a data structure to simulate stacks of dinner plates arranged in piles.
    • Each pile can hold a fixed number of plates (capacity).
    • When pushing a plate, it should go onto the leftmost pile that is not full.
    • When popping a plate, it should come from the rightmost non-empty pile.
    • You can also pop a plate from a specific pile by index.

    API or Method Signatures

    public void push(int val) //Pushes a plate with value `val` onto the leftmost pile with space.
    public int pop() //Pops and returns the plate from the rightmost non-empty pile.
    public int popAtStack(int index) //Pops and returns the plate from the pile index.

    Constraints

    • Capacity is a positive integer.
    • Index in popAtStack may refer to a non-existent or empty pile.
    • If no plates are available to pop, return -1.
    • There is no limit on the number of plates

    Example Input/Output

    DinnerPlateStacks stacks = new DinnerPlateStacks(2);
    stacks.push(1);
    stacks.push(2);
    stacks.push(3);
    stacks.push(4);
    stacks.push(5);
    // The stacks are now:  2  4
    //                      1  3  5
    //                      ﹈ ﹈ ﹈
    stacks.popAtStack(0);  // Output: 2
    // The stacks are now:     4
    //                      1  3  5
    //                      ﹈ ﹈ ﹈
    stacks.push(20);
    // The stacks are now: 20  4
    //                      1  3  5
    //                      ﹈ ﹈ ﹈
    stacks.push(21);
    // The stacks are now: 20  4 21
    //                      1  3  5
    //                      ﹈ ﹈ ﹈
    stacks.popAtStack(0);  // Output: 20
    // The stacks are now:     4 21
    //                      1  3  5
    //                      ﹈ ﹈ ﹈
    stacks.popAtStack(2);  // Output: 21
    // The stacks are now:     4 
    //                      1  3  5
    //                      ﹈ ﹈ ﹈
    stacks.pop();          // Output: 5
    // The stacks are now:     4 
    //                      1  3 
    //                      ﹈ ﹈ ﹈
    stacks.pop();          // Output: 4
    // The stacks are now:      
    //                      1  3 
    //                      ﹈ ﹈ ﹈

    PS : goal is give a working solution with test cases

Know someone preparing? Send it to them:WhatsAppLinkedInX

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