kotak mahindra bank logo
Kotak Mahindra Bank· SDE2/3 Backend Developer

Kotak Mahindra | Machine Coding | SDE2/3 | Backend Developer | With Solution

Posted
8 Feb 2026
414 reads

Summary

I participated in a machine coding interview round for a SDE2/3 Backend Developer role at Kotak Mahindra, where I was challenged to design and implement a Battleship game.

How it went

The interview involved a single machine coding problem where I had to build a complete Battleship game system based on detailed specifications, and then provide a working solution.

Questions asked (1)

  1. 01

    Battleship Game Design & Implementation

    System Design · Hard

    Question: BattleShip Game

    Design and implement a battleship game to be played between two players until one comes out as the winner.

    Requirements:

    • The game will be played in a square area of the sea with NxN grids which will be called a battlefield. “N” should be taken as input in your code.
    • The battlefield will be divided in half between both the players. So in a NxN battlefield, NxN/2 grids will belong to PlayerA and the other NxN/2 grids will belong to playerB
    • The size and location of each ship will be taken as input. Each ship will be assumed to be of Square shape. Both the players should be assigned equal fleet.
    • The location of each ship in the NxN grids has to be taken as input (X, Y). X and Y should be integers. For eg. if a ship “SH1” is at (2, 2) and has the size of 4, its corners will be at (0, 0), (0, 4), (4, 0) and (4,4)
    • Ships will remain stationary. No two ships should overlap with each other. However they can touch boundaries with each other.
    • Each player will fire one missile towards the enemy field during his turn using the “random coordinate fire” strategy, which means the missile will hit at a random coordinate of the opponent’s field. It might hit or miss the opponent ship. In either case the turn is then transferred to the other player.
      • In case of a hit, the opponent’s ship is destroyed.
      • In case of a miss, nothing happens.
    • No two missiles should ever be fired at the same coordinates throughout the course of the game.
    • When all the ships of a particular player has been destroyed, he loses the game.

Know someone preparing? Send it to them:WhatsAppLinkedInX

Interviewed at Kotak Mahindra Bank 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!