当前位置:网站首页>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 )
边栏推荐
- 力扣每日一题(二)
- A convolution substitution of attention mechanism
- [OC-Foundation框架]--<Copy对象复制>
- [OC foundation framework] - [set array]
- R language ggplot2 visualization: place the title of the visualization image in the upper left corner of the image (customize Title position in top left of ggplot2 graph)
- 不同的数据驱动代码执行相同的测试场景
- LeetCode:劍指 Offer 42. 連續子數組的最大和
- LeetCode:124. 二叉树中的最大路径和
- 【图的三大存储方式】只会用邻接矩阵就out了
- [MySQL] limit implements paging
猜你喜欢

Improved deep embedded clustering with local structure preservation (Idec)
![[OC-Foundation框架]---【集合数组】](/img/b5/5e49ab9d026c60816f90f0c47b2ad8.png)
[OC-Foundation框架]---【集合数组】

Alibaba cloud server mining virus solution (practiced)

Advanced Computer Network Review(3)——BBR
![[oc]- < getting started with UI> -- common controls uibutton](/img/4d/f5a62671068b26ef43f1101981c7bb.png)
[oc]- < getting started with UI> -- common controls uibutton

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

Advanced Computer Network Review(5)——COPE

CUDA implementation of self defined convolution attention operator

使用latex导出IEEE文献格式

Esp8266-rtos IOT development
随机推荐
[MySQL] multi table query
Advanced Computer Network Review(3)——BBR
【图的三大存储方式】只会用邻接矩阵就out了
Mise en œuvre de la quantification post - formation du bminf
Tdengine biweekly selection of community issues | phase III
UML diagram memory skills
[oc]- < getting started with UI> -- common controls uibutton
Intel Distiller工具包-量化实现3
Improved deep embedded clustering with local structure preservation (Idec)
[Hacker News Weekly] data visualization artifact; Top 10 Web hacker technologies; Postman supports grpc
LeetCode:162. Looking for peak
LeetCode:26. Remove duplicates from an ordered array
Simple use of promise in uniapp
不同的数据驱动代码执行相同的测试场景
随手记01
Leetcode: Jianzhi offer 03 Duplicate numbers in array
LeetCode:39. 组合总和
Problems encountered in connecting the database of the project and their solutions
LeetCode:236. 二叉树的最近公共祖先
LeetCode:221. 最大正方形