64.minimum-path-sum.cpp: In function ‘int main()’:
64.minimum-path-sum.cpp:67:23: error: cannot bind non-const lvalue reference of type ‘std::vector<std::vector<int> >&’ to an rvalue of type ‘std::vector<std::vector<int> >’
67 | if(minPathSum(vector<vector<int>> 1) == 12)cout << "ACC\n";
| ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
64.minimum-path-sum.cpp:57:46: note: initializing argument 1 of ‘int minPathSum(std::vector<std::vector<int> >&)’
57 | int minPathSum(vector<vector<int>> & grid) {
|
~~~~~~~~~~~~~~~~~~~~~~^~~~
#include<bits/stdc++.h>
#include "stringTo2dVector.h"
using namespace std;
int main(){
vector<vector<int>> c1;
if(minPathSum(c) == 12)cout << "ACC\n"; //No ERROR
else cout << "WA\n";
if(minPathSum(vector<vector<int>> 1) == 12)cout << "ACC\n"; // ERROR
else cout << "WA\n";
}
What is the difference between these 2 approach of passing a 2d vector as argument ?? What is the difference between these 2 approach of passing a 2d vector as argument ??
Aucun commentaire:
Enregistrer un commentaire