problemscpp
A collection of my answers to algorithm problems in c++.
Public 成员函数 | Private 属性 | 所有成员列表
leetcode::detect_squares::DetectSquares类 参考

#include <leetcode.h>

Public 成员函数

 DetectSquares ()
 
void add (vector< int > point)
 
int count (vector< int > point) const
 

Private 属性

multiset< pair< int, int > > ms
 

详细描述

在文件 leetcode.h742 行定义.

构造及析构函数说明

◆ DetectSquares()

leetcode::detect_squares::DetectSquares::DetectSquares ( )

在文件 leetcode.cpp1702 行定义.

1702{ ms = multiset<pair<int, int>>(); }
multiset< pair< int, int > > ms
Definition: leetcode.h:743

引用了 ms.

成员函数说明

◆ add()

void leetcode::detect_squares::DetectSquares::add ( vector< int >  point)

在文件 leetcode.cpp1704 行定义.

1704{ ms.insert(pair(point[0], point[1])); }

引用了 ms.

◆ count()

int leetcode::detect_squares::DetectSquares::count ( vector< int >  point) const

在文件 leetcode.cpp1706 行定义.

1706 {
1707 int count = 0;
1708 for(auto p: ms) {
1709 if(p.first != point[0] && p.second != point[1] && abs(p.first - point[0]) == abs(p.second - point[1])) {
1710 count += ms.count(pair(p.first, point[1])) * ms.count(pair(point[0], p.second));
1711 }
1712 }
1713 return count;
1714 }
int count(vector< int > point) const
Definition: leetcode.cpp:1706

引用了 count() , 以及 ms.

被这些函数引用 count().

类成员变量说明

◆ ms

multiset<pair<int, int> > leetcode::detect_squares::DetectSquares::ms
private

在文件 leetcode.h743 行定义.

被这些函数引用 DetectSquares(), add() , 以及 count().


该类的文档由以下文件生成: