✅  Java | DFS Approach - Just for Understanding
\n// Approach 1: Depth First Search - TLE\n\n// Time complexity: O(n\xB2)\n// Space complexity: O(n\xB2)\t\n\nclass Solution {\n    public boolean[] distanceLim
```\n// Approach 1: Depth First Search - TLE\n\n// Time complexity: O(n\xB2)\n// Space complexity: O(n\xB2)\t\n\nclass Solution {\n    public boolean[] distanceLimitedPathsExist(int n, int[][] edgeList, int[][] queries) {\n        Map<Integer, List<Pair<Integer, Integer>>> adj = new HashMap<>();\n        \n        for (int[] edge : edgeList) {\n            adj.computeIfAbsent(edge[0], k -> new ArrayList<>()).add(new Pair(edge[1], edge[2]));\n            adj.computeIfAbsent(edge[1], k -> new ArrayList<>()).add(new Pair(edge[0], edge[2]));\n        }\n        \n        boolean[] answer = new boolean[queries.length];\n        int i = 0;\n        \n        for (int[] query : queries) {\n            boolean[] visited = new boolean[n];\n            answer[i++] = dfs(adj, query[0], query[1], query[2], visited); \n        }\n        \n        return answer;\n    }\n    \n    private boolean dfs(Map<Integer, List<Pair<Integer, Integer>>> adj, int curr, int dest, int limit, boolean[] visited) {\n        if (curr == dest)\n            return true;\n        \n        visited[curr] = true;\n        \n        if (!adj.containsKey(curr))\n            return false;\n        \n        for (Pair<Integer, Integer> next : adj.get(curr)) {\n            if (!visited[next.getKey()] && next.getValue() < limit) {\n                if (dfs(adj, next.getKey(), dest, limit, visited))\n                    return true;\n            }\n        }\n        \n        return false;\n    }\n}\n```\n**Note:-** This solution gives TLE. It\'s provided just for understanding purpose.\n**Please upvote if you find this solution useful. Happy Coding!**
['Depth-First Search', 'Graph', 'Java']