PROBLEM: http://www.spoj.com/problems/ROBOTGRI/
This was a tough nut!
Its a graph problem. Its actually a combination of 2 problems in one! I have voted it as hard and given it my recommendation.
I went through the following resources (none has the actual solution but all serve as hints) to finally come up with a solution for it:
https://www.cs.bu.edu/teaching/alg/maze/
https://www.hackerearth.com/practice/notes/dynamic-programming-problems-involving-grids/
http://www.geeksforgeeks.org/count-possible-paths-top-left-bottom-right-nxm-matrix/
http://www.geeksforgeeks.org/count-number-ways-reach-destination-maze/
https://www.youtube.com/watch?v=PwxGTHraMNg&feature=youtu.be
http://www.geeksforgeeks.org/applications-of-breadth-first-traversal/
SOLUTION: https://github.com/glassrose/CPP_Problem_Solving/blob/master/SPOJ-ROBOTGRI.cpp
Tested and Accepted: http://www.spoj.com/status/ROBOTGRI,chandniverma/
Time complexity in the worst case: O(n^2 + E)
where n = number of rows (or columns) in the grid
and E = number of edges in the connected graph containing the starting cell 'S'.
Space complexity: O(n^2)
* SDE Career Contemplations * DSA Practice * Problem Solving in Java * Tech in General * Open Source guidance * Career guidance
Subscribe to:
Post Comments (Atom)
Featured Post
interviewBit Medium: Palindrome Partitioning II
Problem Name: Palindrome Partitioning II Problem Description : https://www.interviewbit.com/problems/palindrome-partitioning-ii/ Problem Ap...
-
Many users had requested this feature ( bug ) and it is now available for all to use. Now Empathy supports blocking/unblocking contacts on ...
-
I have been using Linux for quite some time now but only recently got a chance to peek into the internals of the OS I work on in detail. Uni...
-
Hi all, Last week I created a new popup feature that would allow the users to quickly enable/disable accounts from the accounts tree-view ...
No comments:
Post a Comment