0525_contiguous-array

command
v0.0.0-...-60194e6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 9, 2020 License: Unlicense Imports: 0 Imported by: 0

README

0525_contiguous-array

直觉是比较经典的"气球涂色"问题.

  1. 我们将所有的0置换成-1
  2. 遍历一遍数组, 累加数值形成高低变化的"趋势"
    1. 累加的过程中用一个map记录特定数值的第一次出现位置
    2. 之后若是碰到相同的数值, 则判断该位置与记录的第一次位置的距离, 记录这个值得最大值为解

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL