MCPcopy Create free account
hub / github.com/Tiwarishashwat/InterviewCodes / isFeasible

Method isFeasible

FlowerPlantingWithNoAdjacent.java:26–40  ·  view source on GitHub ↗
(int garden,int path[][],int output[],int color)

Source from the content-addressed store, hash-verified

24 }
25
26 public boolean isFeasible(int garden,int path[][],int output[],int color)
27 {
28 for(int i=0;i<path.length;i++)
29 {
30 if(path[i][0]==garden)
31 {
32 if(output[path[i][1]-1]==color) return false;
33 }
34 else if(path[i][1]==garden)
35 {
36 if(output[path[i][0]-1]==color) return false;
37 }
38 }
39 return true;
40 }
41}

Callers 1

backtrackMethod · 0.95

Calls

no outgoing calls

Tested by

no test coverage detected