码迷,mamicode.com
首页 >  
搜索关键字:struct enum    ( 22969个结果
LeetCode 110. 平衡二叉树 Balanced Binary Tree (Easy)
给定一个二叉树,判断它是否是高度平衡的二叉树。 本题中,一棵高度平衡二叉树定义为: 一个二叉树每个节点 的左右两个子树的高度差的绝对值不超过1。 来源:力扣(LeetCode) 解法一:记录树高度 /** * Definition for a binary tree node. * struct T ...
分类:其他好文   时间:2020-05-04 17:24:08    阅读次数:52
7-51 两个有序链表序列的合并 (20分)
1 #include <iostream> 2 using namespace std; 3 typedef struct node 4 { 5 int id; 6 struct node* next; 7 }*L; 8 int main() 9 { 10 L l1=NULL, l2=NULL, l ...
分类:其他好文   时间:2020-05-04 17:22:17    阅读次数:81
网络流
//网络流s const int INF = 0x3f3f3f3f, maxn = 210; struct E { int u, v, flow; E(int u = 0, int v = 0, int flow = 0): u(u), v(v), flow(flow) {} } edg[maxn ...
分类:其他好文   时间:2020-05-04 00:40:18    阅读次数:49
LC 1439. Find the Kth Smallest Sum of a Matrix With Sorted Rows
link class Solution { public: struct Comp{ bool operator()(vector<int>& v1, vector<int>& v2){ return v1[0]+v1[1]>v2[0]+v2[1]; } }; int kthSmallest(vec ...
分类:其他好文   时间:2020-05-03 20:13:29    阅读次数:92
C语言中ctime()和loacaltime()使用中遇到的问题
近期在学习Linux C编程,在使用 localtime() 函数时遇到了比较奇怪的问题,我本想对比文件的最近修改时间和系统当前时间年份是否一致,按说定义两个struct tm*类型指针,再获取到两个struct tm *类型的指针变量后进行比较便可,但是无奈这两个结构体指向的tm_year成员值是 ...
分类:编程语言   时间:2020-05-03 18:33:56    阅读次数:97
[20-05-03][Self-test 36]Java Vampire Number
1 package test_1_1; 2 3 public class VampireNum { 4 5 public static void main(String[] args) { 6 7 /** 8 * 吸血鬼数字是指位数为偶数的数字,可以由一对数字相乘得到 9 * 这对数字各包含乘积的一 ...
分类:编程语言   时间:2020-05-03 18:26:08    阅读次数:62
【树】965. 单值二叉树
题目: 解答: 方法一:深度优先搜索 思路与算法: 我们先进行一次深度优先搜索,获取这颗树中的所有节点的值。然后,就可以判断所有节点的值是不是都相等了。 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * in ...
分类:其他好文   时间:2020-05-03 16:53:20    阅读次数:53
【第八周】编程——线性表
.h #define SEGMENT 50 // 有序线性表元素每段长度 typedef int ElemType; // 定义线性表元素类型为整数 int. typedef struct{ ElemType *elem; // 元素类型的动态数组指针 int size; // 有序线性表的元素个数 ...
分类:其他好文   时间:2020-05-03 16:49:01    阅读次数:50
【树】783. 二叉搜索树节点最小距离
题目: 解答: 同题目530。 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode( ...
分类:其他好文   时间:2020-05-03 16:47:37    阅读次数:52
【树】687. 最长同值路径
题目: 解答: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * TreeNode *left; 6 * TreeNode *right; 7 * TreeNode(int x) : ...
分类:其他好文   时间:2020-05-03 16:30:10    阅读次数:38
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!