Hey @vidyut_1 @vipin1407 @samarthtandon

I was able to solve first question completely and I got only 30 points (TLE for rest of cases ) in 2nd question even though I had solved using same approach as you all did using treeset.

Can you just tell where did I go wrong ?

```
static int[] GreaterEqual(int[] A, int[] X, int[] u, int[] L, int[] v){
// Write your code here
int[] ans = new int[X.length];
ArrayList<ArrayList<Integer>> g= new ArrayList<>();
ArrayList<TreeSet<Integer>> lvl = new ArrayList<>();
for(int i=0;i<u.length+2;++i){
g.add(new ArrayList<Integer>());
lvl.add(new TreeSet<Integer>());
}
for(int i=0;i<u.length;++i){
g.get(u[i]).add(v[i]);
g.get(v[i]).add(u[i]);
}
LinkedList<Integer> q =new LinkedList<>();
int md=0;
boolean vis[]= new boolean[u.length+2];
int[] wl= new int[u.length+2];
q.add(1);
while(!q.isEmpty()){
int n=q.poll();
if(vis[n]) continue;
vis[n]=true;
lvl.get(wl[n]).add(A[n-1]);
ArrayList<Integer> adj= g.get(n);
for(int x:adj){
if(!vis[x]){
wl[x]=wl[n]+1;
md=Math.max(md,wl[x]);
q.add(x);
}
}
}
for(int i=0;i<ans.length;++i){
int ll=L[i]%(md+1) ;
Integer aa=lvl.get(ll).ceiling(X[i]);
if(aa==null){
ans[i]=-1;
}
else{
ans[i]=aa;
}
}
return ans;
}
```