跳至主要內容

接雨水 (trap)

墨七leetcodeleetcode小于 1 分钟约 24 字...

接雨水 (trap)

https://leetcode.cn/problems/trapping-rain-wateropen in new window


解法思路

Golang

package main

import (
	"fmt"
)

func main() {
	nums := []int{
		0, 1, 0, 2, 1, 0, 1, 3, 2, 1, 2, 1,
	}

	results := trap(nums)
	fmt.Println("results", results)
}

// 暴力求解
/*
 */

func trap(height []int) int {
	return 0
}

JavaScript

// 暴力求解
var trap = function (nums) {};
// 代码执行块
(function () {
  const nums = [1, 2, 0, 3, 4, 0, 1, 0, 5, 0];

  const result = trap(nums);
  console.log('result', result);
})();

上次编辑于:
贡献者: mo7
你认为这篇文章怎么样?
  • 0
  • 0
  • 0
  • 0
  • 0
  • 0
评论
  • 按正序
  • 按倒序
  • 按热度