vector的初始化

1.vector<int>v(size)

2.vector<int>v(size,0)

3.vector<int>v={1,2,3,4}

4.int a={1,2,3,4}

vector<int>v(a,a+2)

5.vector<int>v(v0)

leetcode334:注意判定条件的顺序,开始时先设定first<second,所以只要遇见大于second则返回true;因为已经确认num>second,但不能保证first<second,所以只能令second=num;当知道num<first时,令num为新的first,因为前面已经有一个first<num。

posted @ 2023-04-25 15:31  iu本u  阅读(16)  评论(0)    收藏  举报