当前位置:网站首页>Leetcode problem solving 2.1.1
Leetcode problem solving 2.1.1
2022-07-06 09:04:00 【Long time no see 0327】
distance() The function is used to calculate the number of elements in the range represented by two iterators
template<class Inputlterator>
typename iterator_traits<Inputlterator>::difference_type distance(Inputlterator first, Inputlterator last);
#include<iostream>
#include<iterator>
#include<list>
using namespace std;
int main() {
// Create an empty list Containers
list<int> mylist;
// Empty list Add elements to the container 0~9
for (int i = 0; i < 10; i++) {
mylist.push_back(i);
}
// Appoint 2 Two way iterators , Used to execute a certain interval
list<int>::iterator first = mylist.begin(); // Point to elements 0
list<int>::iterator last = mylist.end(); // Point to elements 9 The position after
// obtain [first, last) Number of elements in the range
cout << "distance() = " << distance(first, last);
return 0;
}
unique The function of the function is to remove duplicate elements . namely “ Delete ” All adjacent repeating elements in the sequence ( Keep only one )
边栏推荐
猜你喜欢
BN folding and its quantification
不同的数据驱动代码执行相同的测试场景
A convolution substitution of attention mechanism
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
什么是MySQL?MySql的学习之路是怎样的
opencv+dlib实现给蒙娜丽莎“配”眼镜
项目连接数据库遇到的问题及解决
TP-LINK 企业路由器 PPTP 配置
Digital people anchor 618 sign language with goods, convenient for 27.8 million people with hearing impairment
Detailed explanation of dynamic planning
随机推荐
Revit secondary development Hof method calls transaction
LeetCode:34. 在排序数组中查找元素的第一个和最后一个位置
多元聚类分析
vb. Net changes with the window, scales the size of the control and maintains its relative position
Show slave status \ read in G_ Master_ Log_ POS and relay_ Log_ The (size) relationship of POS
[text generation] recommended in the collection of papers - Stanford researchers introduce time control methods to make long text generation more smooth
LeetCode:498. Diagonal traversal
Mise en œuvre de la quantification post - formation du bminf
BN折叠及其量化
The ECU of 21 Audi q5l 45tfsi brushes is upgraded to master special adjustment, and the horsepower is safely and stably increased to 305 horsepower
An article takes you to understand the working principle of selenium in detail
I-BERT
BN folding and its quantification
LeetCode:498. 对角线遍历
LeetCode41——First Missing Positive——hashing in place & swap
LeetCode:836. 矩形重叠
CUDA实现focal_loss
LeetCode:41. Missing first positive number
[oc]- < getting started with UI> -- common controls uibutton
CSP first week of question brushing