美文网首页
63. Search in Rotated Sorted Arr

63. Search in Rotated Sorted Arr

作者: 博瑜 | 来源:发表于2017-07-12 08:26 被阅读0次
public class Solution {
/** 
 * param A : an integer ratated sorted array and duplicates are allowed
 * param target :  an integer to be search
 * return : a boolean 
 */
public boolean search(int[] A, int target) {
    // write your code here
    if (A == null) return false;
    int length = A.length;
    for (int i = 0; i < length; i++) {
        if (A[i] == target) return true;
    }
    return false;
}
}

相关文章

网友评论

      本文标题:63. Search in Rotated Sorted Arr

      本文链接:https://www.haomeiwen.com/subject/lobvhxtx.html