1232_check-if-it-is-a-straight-line

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

1232_check-if-it-is-a-straight-line

如果len(coordinates) == 2, 直接返回true.

  1. 保存第一个坐标a
  2. 寻找第一个与a不相同的b, 若b不存在, 或b为最后一个元素, 直接返回true
  3. 通过a, b计算斜率
  4. 遍历余下所有元素, 查看是否符合

注意, 坐标全是int, 小心计算.

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