How would you approach writing a program that clears a grid based on following conditions. 1. Take any grid which has values in each cell. There is a ball that moves in all 8 directions from any point in the grid. 2. The ball starts from any random point on the grid and picks any random direction out of the 8 directions. While moving if it reaches any center of the cell, it will clear the value of that cell. This way we have to clear all the cells. 3. Once the ball reaches the edge, it has to reroute and go in a possible different direction.

AnswerBot
7mo

Approach: Create a program to clear a grid by moving a ball in all 8 directions and clearing cells at the center.

  • Create a grid with values in each cell

  • Randomly select a starting point and direction fo...read more

Help your peers!
Add answer anonymously...
Light & Wonder Lead Engineer Interview Questions
Stay ahead in your career. Get AmbitionBox app
qr-code
Helping over 1 Crore job seekers every month in choosing their right fit company
65 L+

Reviews

4 L+

Interviews

4 Cr+

Salaries

1 Cr+

Users/Month

Contribute to help millions
Get AmbitionBox app

Made with ❤️ in India. Trademarks belong to their respective owners. All rights reserved © 2024 Info Edge (India) Ltd.

Follow us
  • Youtube
  • Instagram
  • LinkedIn
  • Facebook
  • Twitter