diff --git a/Graphs/lc.cpp b/Graphs/lc.cpp new file mode 100644 index 0000000..e84382e --- /dev/null +++ b/Graphs/lc.cpp @@ -0,0 +1,27 @@ +#include +using namespace std; +class Solution{ + public: + vector minimumTime(int n, vector>& edges, vector& disappear) { + // code here + int m = edges.size(); + sort(disappear.begin(), disappear.end()); + long long int dp[n + 1]; + memset(dp, -1, sizeof(dp)); + for (int i = 0; i < m; ++i) { + int u = edges[i][0], v = edges[i][1]; + if (dp[u] == -1 || dp[v] == -1 || dp[u] > dp[v]) + dp[u] = dp[v] + 1; + else + dp[v] = dp[u] + 1; + } + + vector res(n); + for (int i = 1; i <= n; ++i) { + res[i - 1] = dp[i]; + } + return res; + + + } +}; \ No newline at end of file diff --git a/Arrays/ExitPointInMatrix.cpp b/Matrix/ExitPointInMatrix.cpp similarity index 100% rename from Arrays/ExitPointInMatrix.cpp rename to Matrix/ExitPointInMatrix.cpp diff --git a/Matrix/LargestLocalValueinMatrix.cpp b/Matrix/LargestLocalValueinMatrix.cpp new file mode 100644 index 0000000..ef65c77 --- /dev/null +++ b/Matrix/LargestLocalValueinMatrix.cpp @@ -0,0 +1,22 @@ +class Solution { +public: +int findmax(vector>& grid,int row,int col){ + int maxi=INT_MIN; + for(int i=row;i> largestLocal(vector>& grid) { + int n=grid.size(); + vector>ans(n-2,vector(n-2,0)); + for(int i=0;i