"public static boolean routeExists" Code Answer's
You're definitely familiar with the best coding language Whatever that developers use to develop their projects and they get all their queries like "public static boolean routeExists" answered properly. Developers are finding an appropriate answer about public static boolean routeExists related to the Whatever coding language. By visiting this online portal developers get answers concerning Whatever codes question like public static boolean routeExists. Enter your desired code related query in the search bar and get every piece of information about Whatever code related question on public static boolean routeExists.
public static boolean routeExists
public class RoutePlanner {
public static boolean routeExists(int fromRow,
int fromColumn,
int toRow,
int toColumn,
boolean[][] mapMatrix) {
if (mapMatrix == null) {
return false;
}
// Check method parameters for destination.
if (toRow >= mapMatrix.length) {
return false;
}
if (toColumn >= mapMatrix[toRow].length) {
return false;
}
// Check that destination is reachable.
if (!mapMatrix[toRow][toColumn]) {
return false;
}
// Check remaining method parameters.
if (fromRow >= mapMatrix.length) {
return false;
}
if (fromColumn >= mapMatrix[fromRow].length) {
return false;
}
if (!mapMatrix[fromRow][fromColumn]) {
return false;
}
if (fromRow == toRow && fromColumn == toColumn) {
return true;
}
boolean exists = routeExists(fromRow + 1, fromColumn, toRow, toColumn, mapMatrix);
if (!exists) {
exists = routeExists(fromRow, fromColumn + 1, toRow, toColumn, mapMatrix);
}
return exists;
}
public static void main(String[] args) {
boolean[][] mapMatrix = {{true, false, false},
{true, true, false},
{false, true, true}};
System.out.println(routeExists(0, 0, 2, 2, mapMatrix));
}
}
Source: stackoverflow.com
All those coders who are working on the Whatever based application and are stuck on public static boolean routeExists can get a collection of related answers to their query. Programmers need to enter their query on public static boolean routeExists related to Whatever code and they'll get their ambiguities clear immediately. On our webpage, there are tutorials about public static boolean routeExists for the programmers working on Whatever code while coding their module. Coders are also allowed to rectify already present answers of public static boolean routeExists while working on the Whatever language code. Developers can add up suggestions if they deem fit any other answer relating to "public static boolean routeExists". Visit this developer's friendly online web community, CodeProZone, and get your queries like public static boolean routeExists resolved professionally and stay updated to the latest Whatever updates.