Part1.【 thread 】(#include <thread>) C++中的多线程,常通过thread类来定义一个thread对象(子线程)来实现。 thread t1 (func, arg1, arg2...); 其中func可以是一个函数名,或者函数对象;后边跟这个对象的参数; 在定义一个 Read More
posted @ 2020-05-19 21:49 Yx_xixi Views(753) Comments(0) Diggs(0)
Given an unsorted array, find the maximum difference between the successive elements in its sorted form. Return 0 if the array contains less than 2 el Read More
posted @ 2020-05-19 18:21 Yx_xixi Views(200) Comments(0) Diggs(0)
Given an array of integers arr and an integer d. In one step you can jump from index i to index: i + x where: i + x < arr.length and 0 < x <= d.i - x Read More
posted @ 2020-05-19 17:53 Yx_xixi Views(207) Comments(0) Diggs(0)
【 数组与指针 】 1. 指向整型变量的指针 指针变量,表示指向某变量地址的变量,即内存所指向变量的地址。Eg. int a = 1; int *p = &a; => *p = 1; p和*p的值都是可以改变的(在没有const修饰的情况下): p的值该表表示p指向了其他元素,而*p的值改变,表示* Read More
posted @ 2020-04-24 16:40 Yx_xixi Views(210) Comments(0) Diggs(0)
【 局部变量 & 全局变量 】 1. 定义在函数内部的变量即为局部变量(包括函数的参数);定义在函数外部的变量即为全局变量(也称外部变量); 2.有效范围: 局部变量有效范围是从定义处到函数结束(或程序块结束); 全局变量有效范围是从定义处到所在文件结束,即同一文件的其他函数也可访问使用该变量。 【 Read More
posted @ 2020-04-22 20:00 Yx_xixi Views(319) Comments(0) Diggs(0)
LeetCode中,有很多关于一组interval的问题。大体可分为两类: 1.查看是否有区间重叠; 2.合并重叠区间; 3.插入新的区间; 4. 基于interval的其他问题 【 做题通用的关键步骤】: 1. 按照begin时间排序; 2. 判断两个相邻区间是否重叠: 【假设】 a. 给定的区间 Read More
posted @ 2020-04-22 16:55 Yx_xixi Views(243) Comments(0) Diggs(0)
Two elements of a binary search tree (BST) are swapped by mistake. Recover the tree without changing its structure. 来源:力扣(LeetCode)链接:https://leetcode Read More
posted @ 2020-04-18 14:06 Yx_xixi Views(125) Comments(0) Diggs(0)