Meesho SDE-1 Interview Experience

meesho logo
meesho
SDE-1Bengaluru
April 8, 20255 reads

Summary

I interviewed for an SDE-1 position at Meesho in Bengaluru, which included an Online Assessment, Machine Coding, and Hiring Manager rounds. Despite perceived weaknesses in certain areas, I successfully joined the company.

Full Experience

Status:- 2024 Graduate from A private University Working as a SDE-1 At a well settled Startup Location Bengaluru

Interview Info 1st:- OA round 2nd:- Machine Coding Round 3rd:- Hiring Manager Round

Applied through Instahyre and 1 week later got an email from recruiter with the Hackerrank OA Assignment Attached

OA Round

3 DSA Based questions are there in the OA round Questions are not too difficult if you are practicing for DSA regularly

1st one is regarding some sorting and comparison based question in groups of numbers.

2nd one is related to dp on stocks not exactly from the standard. image.png

3rd one is the standard DP question https://leetcode.com/problems/unique-paths/description/

similar to this one.

2nd Round Machine Coding Round Interviewer was so friendly as it is my first machine codeing round. He already told me what is expected from this round The Round is on Hackerrank platform similar to coderpad.

I got a question to design a Vending machine system. In that user can check the number of items, stock up the inventory, add unit of a particular item, user can do transaction, user can get the change.

I am attaching the code for better understanding

import java.io.*;
import java.math.*;
import java.security.*;
import java.text.*;
import java.util.*;
import java.util.concurrent.*;
import java.util.function.*;
import java.util.regex.*;
import java.util.stream.*;

import javax.naming.InitialContext;

import com.google.common.collect.Multiset.Entry;

import static java.util.stream.Collectors.joining;
import static java.util.stream.Collectors.toList;

public class Product{
    int productCode;
    String productName;
    int price;
    public Product(int productCode, String productName, int price){
        this.productCode= productCode;
        this.productName =productName;
        this.price = price;
    }
    
    public int getProductCode(){
        return productCode;
    }
    public String getProductName(){
        return productName;
    }
    public int getProductPrice(){
        return price;
    }
}
public class PaymentService{
    int amount;
    
    public PaymentService(){
        amount = 0;
    }
    
    // public void setAmount(int amount){
    //     this.amount = amount;
    // }
    
    // public int getAmount(){
    //     return amount;
    // }
    
    public void insertMoney(int coins, Map<Product,Integer> selectedproductQuantity){
        amount = amount + coins;
        int totalCartPrice = calculateCurrentCartPrice(selectedproductQuantity);
        
        if(amount<totalCartPrice){
            System.out.println(String.format("Payment received: %d. Remaining amount: %d", amount, totalCartPrice-amount));
        }else {
            String items ="";
            for(Map.Entry<Product,Integer> entry : selectedproductQuantity.entrySet()){
             items+= entry.getKey().getProductName();
             items+= ' ';
            }
            resetAmount();
            System.out.println(String.format("Payment received: %d. Dispensing %s. Returning change: %d", amount, items, amount-totalCartPrice));
        }
    }
    public void resetAmount(){
        amount = 0;
    }
    
    private Integer calculateCurrentCartPrice(Map<Product,Integer> selectedproductQuantity){
        int totalPrice =0;
        for(Map.Entry<Product,Integer> entry : selectedproductQuantity.entrySet()){
            Product product = entry.getKey();
            Integer quantity = entry.getValue();
            totalPrice += product.getProductPrice()*quantity;
        }
    }
}

public class InventoryService{
    Map<Integer, Integer> productQuantity;
    
    public void registerItemIntoInventory(Product product, int quantity){
        productQuantity.put(product.getProductCode(), quantity);
    }
    
    public void addStockInMachine(int itemCode, int quantity){
        Integer currentProductQuantity = productQuantity.getOrDefault(itemCode, 0);
        currentProductQuantity+=quantity;
        productQuantity.put(itemCode, currentProductQuantity);
    }
    
    public Map<Integer,Integer> getProductQuantityMap(){
        return productQuantity;
    }
}

public class VendingMachine{
    
    InventoryService inventoryService;
    PaymentService paymentService;
    Map<Integer, Product> productMap;
    Map<Product,Integer> productCart;
    
    public VendingMachine(){
        this.inventoryService = new InventoryService();
        this.productMap = new HashMap<>();
        this.productCart = new HashMap<>();
        this.paymentService = new PaymentService();
    }
    
    public void viewItems(){
        Map<Integer,Integer> productQuantityMap = inventoryService.getProductQuantityMap();
        List<Product> products = new ArrayList<>(productMap.values());
        if(products.isEmpty()){
            System.out.println("No items available");
        }
        for(Product product: products){
            int quantity = productQuantityMap.get(product.getProductCode());
            System.out.println(String.format("%d %s %d %d", product.getProductCode(), product.getProductName(), product.getProductPrice(), quantity));
        }
    }
    public void registerItem(String productName, int price, int quantity){
        Product product = new Product(productMap.size()+1, productName, price);
        productMap.put(product.getProductCode(), product);
        inventoryService.registerItemIntoInventory(product, quantity);
        System.out.println(String.format("Item added successfully, item_code: %d", product.getProductCode()));
    }
    
    public void selectItem(int itemCode){
        Product product = productMap.get(itemCode);
        Map<Integer,Integer> productQuantityMap = inventoryService.getProductQuantityMap();
        int currentProductQuantity = productQuantityMap.get(itemCode);
        if(currentProductQuantity==0){
            System.out.println("Item is out of stock");
        }
        productCart.put(product, productCart.getOrDefault(product, 0) + 1);
        productQuantityMap.put(product.getProductCode(), productQuantityMap.get(product.getProductCode())-1);
        System.out.println(String.format("You selected: %s %d", product.getProductName(), product.getProductPrice()));
    }
    
    public void addStock(int itemCode, int quantity){
        inventoryService.addStockInMachine(itemCode, quantity);
    }
    
    public void cancelTransaction(){
        for(Map.Entry<Product,Integer> entry : productCart.entrySet()){
            Product product = entry.getKey();
            int quantity = entry.getValue();
            inventoryService.addStockInMachine(product.getProductCode(), quantity);
        }
        productCart = new HashMap<>();
        paymentService.resetAmount();
    }
    
    public void insertMoneyIntoMachine(int coins){
        if(productCart.size()==0){
            System.out.println("Please select a item first");
            return;
        }
        paymentService.insertMoney(coins, productCart);
    }
}

class Result {

    /*
     * Complete the 'vend' function below.
     *
     * The function accepts STRING_ARRAY args as parameter.
     */

    public static void vend(List<String> args) {
        VendingMachine vendingMachine = new VendingMachine();
        for(String arg : args){
            String part[]= arg.split(" ");
            String command = part[0];
            switch(command){
                case "VIEW_ITEMS":
                    vendingMachine.viewItems();
                    break;
                case "REGISTER_ITEM":
                    vendingMachine.registerItem(part[1], Integer.parseInt(part[2]), Integer.parseInt(part[3]));
                    break;
                case "ADDSTOCK":
                    vendingMachine.addStock(Integer.parseInt(part[1]),Integer.parseInt(part[2]));
                    break;
                case "SELECT_ITEM":
                    vendingMachine.selectItem(Integer.parseInt(part[1]));
                    break;
                case "INSERT_MONEY":
                    vendingMachine.insertMoneyIntoMachine(Integer.parseInt(part[1]));
                    break;
                case "CANCEL":
                    vendingMachine.cancelTransaction();
            }
        }
        

}


public class Solution {
    public static void main(String[] args) throws IOException {
        BufferedReader bufferedReader = new BufferedReader(new InputStreamReader(System.in));

        int argsCount = Integer.parseInt(bufferedReader.readLine().trim());

        List<String> aargs = IntStream.range(0, argsCount).mapToObj(i -> {
            try {
                return bufferedReader.readLine();
            } catch (IOException ex) {
                throw new RuntimeException(ex);
            }
        })
            .collect(toList());

        Result.vend(args);

        bufferedReader.close();
    }
}

make sure to communicate properly with interviewer before making any design decisions or any class decisions. Communication is more important here.

The above code is not compiled as their compiler has some issue that's why i gave a dry run to interviewer.

3rd Round Hiring Manager Round Got confirmation for this round 2 days post maching coding but it is scheduled after a week. This is my first Hiring manager round a little nervous, as my computer fundamentals are weak.

Round started with an introduction from hiring manager side and then from my end too. Do make sure to add some more points into your introduction regarding the impact you have made in your current role.

This round was quite resume grill round, Make sure whatever word you are using while communication, He will ask questions from it.

Read your resume properly and questions to self by thinking like you are not aware about anything in this project.

Post resume grilling, he started asking memory management, Concurrency, race conditions, stack and heaps in the memory.

There are questions on OS too like on indexing.

Networking questions are also there on sockets, TCP/UDP protocols.

Internals of Hashmaps, LFU, LRU. It's implementation everything is verbally.

Behavioral questions how do you handle conflict between you are your colleagues. how do you manage criticism while work. how do you handle payload from other stakeholders while you are fully overloaded.

Probably i will be getting rejected, because I don't have answer to network and os memory fundamentals.

Update:- Joined

Interview Questions (7)

Q1
Unique Paths
Data Structures & AlgorithmsMedium

A standard Dynamic Programming question, similar to LeetCode's Unique Paths problem, where a robot can only move either down or right to reach the bottom-right corner of a m x n grid.

Q2
Design Vending Machine System
System Design

Design a Vending Machine system where users can check available items, stock up inventory, add units of specific items, perform transactions, and receive change. Communication with the interviewer on design decisions was emphasized.

Q3
Computer Fundamentals: Memory Management & Concurrency
Other

Questions on memory management, concurrency, race conditions, and the concepts of stack and heap memory.

Q4
Operating Systems: Indexing
Other

Questions related to Operating Systems, specifically on indexing.

Q5
Networking: Sockets & TCP/UDP
Other

Networking questions covering sockets, TCP, and UDP protocols.

Q6
Data Structures & Caching: Hashmaps, LFU, LRU
Data Structures & Algorithms

Detailed questions on the internals of Hashmaps, as well as LFU (Least Frequently Used) and LRU (Least Recently Used) caching mechanisms and their implementations.

Q7
Behavioral Questions: Conflict, Criticism, Overload
Behavioral

Behavioral questions included: How do you handle conflict between you and your colleagues? How do you manage criticism while at work? How do you handle payload from other stakeholders when you are fully overloaded?

Discussion (0)

Share your thoughts and ask questions

Join the Discussion

Sign in with Google to share your thoughts and ask questions

No comments yet

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