当前位置:网站首页>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 )
边栏推荐
- TP-LINK 企业路由器 PPTP 配置
- [OC-Foundation框架]-<字符串And日期与时间>
- MYSQL卸载方法与安装方法
- Advance Computer Network Review(1)——FatTree
- Intel distiller Toolkit - Quantitative implementation 2
- 【嵌入式】Cortex M4F DSP库
- LeetCode:剑指 Offer 42. 连续子数组的最大和
- [today in history] February 13: the father of transistors was born The 20th anniversary of net; Agile software development manifesto was born
- Alibaba cloud server mining virus solution (practiced)
- Different data-driven code executes the same test scenario
猜你喜欢

LeetCode41——First Missing Positive——hashing in place & swap

Advanced Computer Network Review(5)——COPE

【嵌入式】使用JLINK RTT打印log
![[embedded] print log using JLINK RTT](/img/22/c37f6e0f3fb76bab48a9a5a3bb3fe5.png)
[embedded] print log using JLINK RTT

Advanced Computer Network Review(4)——Congestion Control of MPTCP

Export IEEE document format using latex

自定义卷积注意力算子的CUDA实现

Simple use of promise in uniapp

MYSQL卸载方法与安装方法

Nacos 的安装与服务的注册
随机推荐
TDengine 社区问题双周精选 | 第三期
MongoDB 的安装和基本操作
Advance Computer Network Review(1)——FatTree
【shell脚本】使用菜单命令构建在集群内创建文件夹的脚本
力扣每日一题(二)
BMINF的后训练量化实现
Leetcode: Jianzhi offer 03 Duplicate numbers in array
Revit secondary development Hof method calls transaction
Leetcode: Sword finger offer 42 Maximum sum of continuous subarrays
超高效!Swagger-Yapi的秘密
使用latex导出IEEE文献格式
LeetCode:39. Combined sum
ant-design的走马灯(Carousel)组件在TS(typescript)环境中调用prev以及next方法
pytorch查看张量占用内存大小
LeetCode41——First Missing Positive——hashing in place & swap
UML圖記憶技巧
在QWidget上实现窗口阻塞
Intel Distiller工具包-量化实现1
项目连接数据库遇到的问题及解决
Using C language to complete a simple calculator (function pointer array and callback function)