【leetcode】42. Trapping Rain Water

網址 題目 解法 本來還想着木桶原理什麼的,但是不太會做,用了笨笨的方法一層一層的加。 除此之外,本題還有其它效率更高的做法,詳見博客,暫時沒時間研究了。 class Solution { public int trap(int[] height) { int cur_height = 1, ans = 0; while(true){
相關文章
相關標籤/搜索