BotClean Stochastic
-
-
yashdeora98294 3 years ago here is problem solution in java python and c++ programming. https://www.gyangav.com/2022/03/hackerrank-botclean-stochastic-problem-solution.html
-
mohammed_abdali1 3 years ago But what was I supposed to have had learned? The original one I programmed as "Check to see if standing on dirty floor. If so, clean it and quit. Otherwise start looking at the top left corner and read the grid like you would a book (the normal method of reading a matrix, that is). As soon as you encounter a dirty floor, make note of it and stop reading the grid. If your robot is too low or too high, move one step up or down as needed, and then exit. However, if you're already at the right level, then move either left or right as needed, and exit."
This exact logic works for "what if I generate a new dirty floor after you clean the first one?" I guess the only technicality is that I have 200 steps instead of infinity (I think I had infinite in the first challenge), but considering I got full points, it looks like that constraint doesn't matter...
Unless there was an easier (less complex) solution that was expected for the first challenge. But I mean... what's less complex than the brute force method of "try to find the lowest index of a 1d array that has dirt, and then try to move towards it"?
-
These are learning based challenges so, the changes needed for subsequent challenges are minimal. That's the whole point of the exercise.
These challenges teaches you about different environments in which a rational agent of AI is put into and how it should behave.
Add Reply Preview cancel