class Solution {
public:
int search(vector& nums, int target) {
int count=0; for(unsigned long i=0; i<nums.size(); ++i){ if(nums[i]==target) { return nums[i]; ++count; break;} } if(count==0) return -1; }
};
Aucun commentaire:
Enregistrer un commentaire