码迷,mamicode.com
首页 > 其他好文 > 详细

Rotate Image

时间:2014-08-06 22:21:42      阅读:222      评论:0      收藏:0      [点我收藏+]

标签:blog   io   for   ar   问题   div   amp   log   

问题:矩阵顺时针旋转90度

class Solution {
public:
    bool dfs(vector<vector<int> > &matrix,int target,int n)
    {
        if(n==matrix.size()) return false;
        if(matrix[n][0]>target) return false;
        for(int i=0;i<matrix[n].size();i++)
        {
            if(matrix[n][i]==target) return true;
            if(matrix[n][i]>target) return false;
        }
        return dfs(matrix,target,n+1);
    }
    bool searchMatrix(vector<vector<int> > &matrix, int target) {
        return dfs(matrix,target,0);
    }
};

  

Rotate Image,布布扣,bubuko.com

Rotate Image

标签:blog   io   for   ar   问题   div   amp   log   

原文地址:http://www.cnblogs.com/zsboy/p/3895605.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!