求助!为何报错?


本文摘自网络,作者zsm666,侵删。

问题已解决,原因是多了个}

func uniquePathsWithObstacles(obstacleGrid [][]int) int {
    m :=len(obstacleGrid[:][0])
    n :=len(obstacleGrid[0][:])
    var i,j int
    for a :=0;i<m;i++ {
        for b :=0;j<n;j++ {
            switch obstacleGrid[a][b] {
                case 1: obstacleGrid[a][b]=0 
                case 0 :obstacleGrid[a][b]=1 
            }
          }  
        }

    for i=1;i<m;i++ {
        for j=1;j<n;j++ {
            if obstacleGrid[i][j]!=0 {
                obstacleGrid[i][j]=obstacleGrid[i-1][j]+obstacleGrid[i][j-1]
            }
        
        }
    }
    return obstacleGrid[m-1][n-1]
}

 


相关阅读 >>

[Go] Golang 中main包下入口文件调用其它Go文件函数出现undefined

这家独角兽旅行服务公司,在用 Go 进行微服务治理

Go - 实现项目内链路追踪(二)

Go语言基础之运算符

Golang pprof 性能分析工具

Gof linux epoll模型的实现

实用在线工具网站 https://qetool.com

Golang有web框架吗

手撸Golang Go与微服务 聚合模式

Go中sync.mutex源码解读

更多相关阅读请进入《Go》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...

    暂无评论...