```
int findMin(vector<int> &num) {
vector<int>::iterator iter;
int first,min;
if(num.size()==1)
return *num.begin();
else if(*num.begin()>*--num.end())
{
first=*num.begin();
for(iter=++num.begin();iter!=num.end();++iter)
{
if(*iter<first)
{
min=*iter;
break;
}
}
}
else
{
first=*num.begin();
for(iter=++num.begin();iter!=num.end();++iter)
{
if(*iter>first)
{
min=*(--iter);
break;
}
}
}
return min;
}
```