摘要: Given a binary tree, determine if it is height-balanced. For this problem, a height-balanced binary tree is defined as: a binary tree in which the lef 阅读全文
posted @ 2021-04-20 15:45 Makerr 阅读(38) 评论(0) 推荐(0) 编辑
摘要: Given a non-empty array of integers nums, every element appears twice except for one. Find that single one. Follow up: Could you implement a solution 阅读全文
posted @ 2021-04-20 14:39 Makerr 阅读(39) 评论(0) 推荐(0) 编辑
摘要: Given a binary tree, return the sum of values of nodes with even-valued grandparent. (A grandparent of a node is the parent of its parent, if it exist 阅读全文
posted @ 2021-04-17 16:39 Makerr 阅读(53) 评论(0) 推荐(0) 编辑
摘要: Given two binary search trees root1 and root2. Return a list containing all the integers from both trees sorted in ascending order. Example 1: Input: 阅读全文
posted @ 2021-04-17 14:44 Makerr 阅读(39) 评论(0) 推荐(0) 编辑
摘要: 1323. Maximum 69 Number Easy 56289Add to ListShare Given a positive integer num consisting only of digits 6 and 9. Return the maximum number you can g 阅读全文
posted @ 2021-04-17 14:18 Makerr 阅读(42) 评论(0) 推荐(0) 编辑
摘要: Given a binary search tree, return a balanced binary search tree with the same node values. A binary search tree is balanced if and only if the depth 阅读全文
posted @ 2021-04-17 09:33 Makerr 阅读(36) 评论(0) 推荐(0) 编辑
摘要: Given a directed acyclic graph (DAG) of n nodes labeled from 0 to n - 1, find all possible paths from node 0 to node n - 1, and return them in any ord 阅读全文
posted @ 2021-04-16 21:19 Makerr 阅读(37) 评论(0) 推荐(0) 编辑
摘要: 冒泡排序 相邻的两个数两两比较,如果两数逆序,则交换。 n个数需要进行n-1趟的两两比较。 10个数进行冒泡排序,输出结果 #include <stdio.h> int main() { int a[10],i,j,temp; printf("请输入10个数:"); for(i=0;i<10;++i 阅读全文
posted @ 2021-04-16 16:58 Makerr 阅读(82) 评论(0) 推荐(0) 编辑
摘要: There is an m x n matrix that is initialized to all 0's. There is also a 2D array indices where each indices[i] = [ri, ci] represents a 0-indexed loca 阅读全文
posted @ 2021-04-15 17:08 Makerr 阅读(44) 评论(0) 推荐(0) 编辑
摘要: 1、数组a中一组数(a[i]只能是0或者1),0变成1,1变成0,怎样操作?比如,lt 832题 答:a[i]与1进行异或运算(异或运算:不同为真,相同为假) 2、判断一个数是奇数还是偶数?比如,lt 1342题 一个数的二进制从右向左的与1进行&运算,结果为0,则这个十进制数是偶数,结果为1,则这 阅读全文
posted @ 2021-04-15 11:39 Makerr 阅读(40) 评论(0) 推荐(0) 编辑