二维数组中的查找

static const auto io_sync_off=[](){
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
return nullptr;
}();
class Solution {
public:
bool Find(int target, vector<vector<int> > array) {

int row = array.size();
int column = array[0].size();
int a = 0;
for(int i=0;i<row;i++)
{
for(int j=0;j<column;j++)
{
if(array[i][j]==target)
{
a++;
return true;
}
}
}
return false;
}
};
全部评论

相关推荐

06-10 23:36
已编辑
首都经济贸易大学 C++
点赞 评论 收藏
分享
陈逸轩1205:才105 哥们在养生呢
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务