We use cookies to ensure you have the best browsing experience on our website. Please read our cookie policy for more information about how we use cookies.
- Prepare
- Algorithms
- Search
- Count Luck
- Discussions
Count Luck
Count Luck
Sort by
recency
|
180 Discussions
|
Please Login in order to post a comment
Explanation:
Find Starting Point:
findStartingPoint
scans the matrix to find the position of 'M' (start).Within Bounds Check:
isWithinBounds
ensures the coordinates are within the grid.Breadth-First Search (BFS):
possibleMoves
.Decision Points:
Result:
k
, print "Impressed"; otherwise, print "Oops!".This code reads input directly from
stdin
, which is typical for competitive programming environments like HackerRank. Make sure to test this solution within the constraints of the problem to ensure it works correctly.Ruby
C++ (more at https://github.com/IhorVodko/Hackerrank_solutions , feel free to give a star :) )
Here is my solution in java, javascript, python, C, C++, Csharp Click Here