LeetCode(942)

令min = 0,max = n,

从0到n-1扫描s,如果s[i]是I就令结果vector添加一个元素min并令min++

         如果s[i]是D就令结果vector添加一个元素max并令max--

最后添加一个元素min或者max(min==max)

 

posted @ 2022-05-09 19:36  智人心  阅读(19)  评论(0)    收藏  举报