Advertisement
CR7CR7

minDis

Aug 27th, 2023
1,527
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.42 KB | None | 0 0
  1. class Solution {
  2. public:
  3.     bool graph(int N, vector<vector<int>> adj) {
  4.         for (int i = 0; i < N; i++) {
  5.             for (int j = 0; j < N; j++) {
  6.                 for (int k = 0; k < N; k++) {
  7.                    
  8.                     if (adj[i][j] > adj[i][k] + adj[k][j]) {
  9.                         return false;
  10.                     }
  11.                 }
  12.             }
  13.         }
  14.         return true;
  15.     }
  16. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement