Simple Javascript solution
\n# Complexity\n- Time complexity:\n Add your time complexity here, e.g. O(n) \n\n- Space complexity:\n Add your space complexity here, e.g. O(n) \n\n# Code\n\n
\n# Complexity\n- Time complexity:\n<!-- Add your time complexity here, e.g. $$O(n)$$ -->\n\n- Space complexity:\n<!-- Add your space complexity here, e.g. $$O(n)$$ -->\n\n# Code\n```\n/**\n * @param {number} n\n * @param {number[][]} edgeList\n * @param {number[][]} queries\n * @return {boolean[]}\n */\nvar distanceLimitedPathsExist = function(n, edgeList, queries) {\n    let index = new Array(n).fill().map((_,i) => i);\n    let keys = new Array(queries.length).fill().map((_,i) => i)\n    let result = new Array(queries.length), j = 0\n\n    const find = (x) => x !== index[x] ? index[x] = find(index[x]) : index[x]\n    const union = (x,y) => index[find(x)] = find(y)\n    edgeList.sort((a,b) => a[2] - b[2])\n    keys.sort((a,b) => queries[a][2] - queries[b][2])\n\n    for (let i of keys) {\n        let [a,b,c] = queries[i]\n        while (edgeList[j]?.[2] < c) union(edgeList[j][0], edgeList[j++][1])\n        result[i] = find(a) === find(b)\n    }\n    return result\n};\n```
['JavaScript']