google logo
Google· SDE-3

Google SDE-3 Interview | 95Lakhs CTC

Location
Bangalore
Posted
12 Sept 2026
160 reads

Summary

I attended an offline interview for a Google SDE-3 role in Bangalore and was asked a matrix walk problem.

How it went

Had offline interview round in BLR. This was one of the questions asked :-

You are standing at a particular position in a matrix of size N*M - Some cells are free , but some cells have obstacles in them which you cannot visit. It is guaranteed that you are initially standing on a free cell. Find a valid walk of size exactly “k” such that you start from your starting position - walk “k” steps and reach back your original position after “k” steps. Output that path. If there are multiple possible paths of size “k” - output the path which is lexicographically minimal string consisting of possible characters from the set - (“L”,”R”,”U”,”D”)

Free cell - ‘.’ Start position - ‘x’ Obstacle - ‘#’

Questions asked (1)

  1. 01

    Lexicographically Minimal Walk of Length k Returning to Start

    Data Structures & Algorithms

    You are standing at a particular position in a matrix of size N*M. Some cells are free, but some cells have obstacles in them which you cannot visit. It is guaranteed that you are initially standing on a free cell. Find a valid walk of size exactly "k" such that you start from your starting position, walk "k" steps and reach back to your original position after "k" steps. Output that path. If there are multiple possible paths of size "k", output the path which is the lexicographically minimal string consisting of characters from the set {"L", "R", "U", "D"}.

    Free cell: '.' Start position: 'x' Obstacle: '#'

Know someone preparing? Send it to them:WhatsAppLinkedInX

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