leetcode笔记_树
摘要:树 树的遍历 前序遍历 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNode *left; * TreeNode *right; * TreeNode() : val(0), left(n
阅读全文
posted @
2021-07-28 20:55
Miranda2021
阅读(126)
推荐(0)
leetbook笔记_数组和字符串
摘要:数组和字符串 数组简介 寻找数组的中心索引 给你一个整数数组 nums ,请计算数组的 中心下标 。 数组 中心下标 是数组的一个下标,其左侧所有元素相加的和等于右侧所有元素相加的和。 如果中心下标位于数组最左端,那么左侧数之和视为 0 ,因为在下标的左侧不存在元素。这一点对于中心下标位于数组最右端
阅读全文
posted @
2021-07-28 20:54
Miranda2021
阅读(140)
推荐(0)
leetbook笔记_栈和队列
摘要:栈和队列 队列 先入先出的数据结构 设计队列 class MyCircularQueue {public: int *queue; int size; int maxSize; MyCircularQueue(int k) { size=0; maxSize=k; queue=new int[k];
阅读全文
posted @
2021-07-28 20:54
Miranda2021
阅读(122)
推荐(0)
leetbook笔记_链表
摘要:链表 设计链表 class Node { public: int val; Node* next; Node() { this->next = nullptr; } }; class MyLinkedList { public: /** Initialize your data structure
阅读全文
posted @
2021-07-28 20:53
Miranda2021
阅读(99)
推荐(0)