# 1971. Find if Path Exists in Graph

1971. Find if Path Exists in Graph

``````class Solution {
public boolean validPath(int n, int[][] edges, int source, int destination) {
if(source == destination) return true;
Graph g = new Graph(n);

for(int i = 0 ; i < edges.length; i++){
}
boolean[] visited = new boolean[n];

visited[source] =true;
while(!q.isEmpty()){
int current = q.poll();
while (i.hasNext())
{
int next = i.next();
if(next == destination) return true;
if (!visited[next])
{
visited[next] = true;

}
}

}

return false;
}
class Graph
{
private int V;   // No. of vertices

// Constructor
Graph(int v)
{
V = v;
for (int i=0; i<v; ++i)
}

// Function to add an edge into the graph
{
}
}
}``````

# 1470. Shuffle the Array

1470. Shuffle the Array

``````class Solution {
public int[] shuffle(int[] nums, int n) {
int[] out = new int[nums.length];
int x =0;
int y = nums.length/2;
for(int i = 0; i < nums.length; i++){
if(i % 2 == 0){
out[i] = nums[x];
x++;
}else{
out[i] = nums[y];
y++;
}
}
return out;
}
}``````