1、什么是栈 栈也是一种线性结构, 相比数组,栈对应的操作是数组的子集 只能从一端添加元素,也只能从一端取出元素 这一端称为栈顶 栈是一种后进先出的数据结构。 2、栈的应用 1) 编辑器无处不在的Undo操作(撤销) 2) 程序调用的系统栈 函数A中调用函数B,函数B中调用函数C。 如果C函数执行完 ...
分类:
其他好文 时间:
2021-02-08 12:24:23
阅读次数:
0
24. 两两交换链表中的节点 题目链接 直接换 class Solution { public ListNode swapPairs(ListNode head) { if(head == null) return null; if(head.next == null) return head; L ...
分类:
其他好文 时间:
2021-02-08 12:14:55
阅读次数:
0
leetcode打卡 题面 class Solution { public: bool checkPossibility(vector<int> &nums) { int n = nums.size(); for (int i = 0; i < n - 1; ++i) { int x = nums[ ...
分类:
其他好文 时间:
2021-02-08 12:11:43
阅读次数:
0
1.三个多线程可能引起的问题 package other; public class UnSafeTicker implements Runnable { private int ticket=10; boolean flag=true; @Override public void run() { ...
分类:
编程语言 时间:
2021-02-08 12:09:22
阅读次数:
0
public class ArrayListTest { public static void main(String[] args) { String[] arr = new String[]{"AA", "BB", "CC", "DD", "EE"}; // 数组的复制 String[] arr ...
分类:
编程语言 时间:
2021-02-08 12:03:48
阅读次数:
0
class Solution { public: vector<vector<int>> threeSum(vector<int>& nums) { int n=nums.size(); vector<vector<int>>ans; if(n<3) return{}; sort(nums.begi ...
分类:
其他好文 时间:
2021-02-08 11:52:34
阅读次数:
0
class Solution { public: int f[1005][1005]; int longestCommonSubsequence(string text1, string text2) { memset(f,0,sizeof(f)); int n=text1.size(); int ...
分类:
其他好文 时间:
2021-02-08 11:51:48
阅读次数:
0
因为Prometheus是通过http接口的形式来采集数据的,所以需要向Prometheus server暴露端点。spring boot2.x版本在Actuator中集成了Prometheus,此外也可以手动向其暴露端点。接下来就说第二种。 @Spi public interface MeterR ...
分类:
Web程序 时间:
2021-02-08 11:51:33
阅读次数:
0
这道题要求将数组中奇数放前面偶数放后面,不需要排序。 第一时间想到的是额外数组res存结果,遍历原数组奇数存在res前面,偶数存在res后面。 时间复杂度O(n),空间复杂度O(n),好处是没有修改原数组 class Solution { public int[] exchange(int[] nu ...
分类:
编程语言 时间:
2021-02-08 11:47:07
阅读次数:
0
监听文本框输入文字 实现界面输入文本传回idae控制台 代码: import java.awt.*; import java.awt.event.ActionEvent; import java.awt.event.ActionListener; public class TestText01 { ...
分类:
其他好文 时间:
2021-02-08 11:46:20
阅读次数:
0