当前位置:网站首页>Force buckle 1232 Dotted line
Force buckle 1232 Dotted line
2022-07-07 20:06:00 【Tomorrowave】
1232. Dotted line
Given an array coordinates , among coordinates[i] = [x, y] , [x, y] The abscissa is x、 Ordinate for y The point of . Please judge , Whether these points belong to the same line in the coordinate system .
Example 1:
Input :coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]]
Output :true
Ideas
Use the product of slope to do
Code section
class Solution:
def checkStraightLine(self, coordinates: List[List[int]]) -> bool:
a=coordinates[1][0]-coordinates[0][0]
b=coordinates[1][1]-coordinates[0][1]
for i in range(2,len(coordinates)):
c = coordinates[i][0] - coordinates[0][0]
d = coordinates[i][1] - coordinates[0][1]
if (a * d - b * c != 0):
return False
return True
边栏推荐
- Sword finger offer II 013 Sum of two-dimensional submatrix
- Le PGR est - il utile au travail? Comment choisir une plate - forme fiable pour économiser le cœur et la main - d'œuvre lors de la préparation de l'examen!!!
- R language ggplot2 visualization: use the ggecdf function of ggpubr package to visualize the grouping experience cumulative density distribution function curve, and the linetype parameter to specify t
- 数据孤岛是企业数字化转型遇到的第一道险关
- 力扣 1037.有效的回旋镖
- 银行理财产品怎么买?需要办银行卡吗?
- torch. nn. functional. Pad (input, pad, mode= 'constant', value=none) record
- 时间工具类
- The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
- torch.nn.functional.pad(input, pad, mode=‘constant‘, value=None)记录
猜你喜欢

Automatic classification of defective photovoltaic module cells in electroluminescence images-论文阅读笔记

LeetCode_7_5

【STL】vector

Detailed explanation of Flink parallelism and slot

Compiler optimization (4): inductive variables

BI的边界:BI不适合做什么?主数据、MarTech?该如何扩展?

开源OA开发平台:合同管理使用手册

Open source heavy ware! Chapter 9 the open source project of ylarn causal learning of Yunji datacanvas company will be released soon!

ASP. Net kindergarten chain management system source code

The state cyberspace Office released the measures for data exit security assessment: 100000 information provided overseas needs to be declared
随机推荐
JVM class loading mechanism
MSE API学习
干货分享|DevExpress v22.1原版帮助文档下载集合
Tp6 realize Commission ranking
mysql 的一些重要知识
Make this crmeb single merchant wechat mall system popular, so easy to use!
ASP.NET学习& asp‘s one word
整型int的拼接和拆分
openEuler 资源利用率提升之道 01:概论
力扣 599. 两个列表的最小索引总和
论文解读(ValidUtil)《Rethinking the Setting of Semi-supervised Learning on Graphs》
TS快速入门-泛型
8 CAS
gorilla官方:golang开websocket client的示例代码
LeetCode_7_5
ASP. Net learning & ASP's one word
Nunjuks template engine
模拟实现string类
ASP.NET体育馆综合会员管理系统源码,免费分享
【STL】vector