C++ beats 100 100 using dijksta and dfs with memoization
\nclass Solution {\npublic:\n// Declaring variables gloabally so that we don\'t need to pass every time in function and we can directly access in dfs function\n
```\nclass Solution {\npublic:\n// Declaring variables gloabally so that we don\'t need to pass every time in function and we can directly access in dfs function\n    unordered_map <int,vector <pair<int,int>>> m;\n    vector <int> dist;\n    vector <int> dp;\n    int N;\n    int MOD=1000000007;\n    int countRestrictedPaths(int n, vector<vector<int>>& edges) {\n        vector <int> vis(n+1,0);\n        dist.resize(n+1,INT_MAX);\n        dp.resize(n+1,-1);\n        dist[0]=0;\n        N=n;\n        for(auto i:edges)\n        {\n            m[i[0]].push_back({i[1],i[2]});\n            m[i[1]].push_back({i[0],i[2]});\n        }\n        set <pair <int,int>> q;\n        q.insert({0,n});\n        dist[n]=0;\n        while(!q.empty())\n        {\n            int u=q.begin()->second;\n            q.erase(q.begin());\n            vis[u]=1;\n            for(auto p:m[u])\n            {\n                int v=p.first;\n                int w=p.second;\n                if(!vis[v])\n                {\n                    if(dist[u]+w<dist[v])\n                    {\n                        dist[v]=dist[u]+w;\n                        q.insert({dist[v],v});\n                    }\n                }\n            }\n        }\n        return dfs(1);\n    }\n    \n    int dfs(int u)\n    {\n        if(dp[u]!=-1)\n            return dp[u];\n        int ans=0;\n        if(u==N)\n            return 1;\n        for(auto p:m[u])\n        {\n            int v=p.first;\n            if(dist[v]<dist[u])\n                ans=(ans+dfs(v))%MOD;\n        }\n        return dp[u]=ans;\n    }\n};\n```\n\n
['Dynamic Programming', 'Ordered Set', 'C++']