/** * Definition for a binary tree node. * public class TreeNode { * int val; * TreeNode left; * TreeNode right; * TreeNode(int x) { val = x; } * } */ ...
分类:
其他好文 时间:
2020-07-18 15:54:16
阅读次数:
51
本文中案例都会在上传到git上,请放心浏览 git地址:https://github.com/muxiaonong/Spring-Cloud/tree/master/order-lock 本文会使用到 三台 redis 独立服务器,可以自行提前搭建好 前言 在Java中,我们对于锁会比较熟悉,常用的 ...
分类:
其他好文 时间:
2020-07-18 15:49:42
阅读次数:
60
kyu8--fake binary 将小于5的数字用0掩码,大于等于5的用1掩码,用string 下面的答案是高赞的答案。return s.translate(string.maketrans('0123456789', '0000011111')) ...
分类:
其他好文 时间:
2020-07-18 13:46:35
阅读次数:
64
链接:https://leetcode-cn.com/problems/unique-binary-search-trees-ii/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNo ...
分类:
其他好文 时间:
2020-07-18 13:39:30
阅读次数:
56
一、问题描述 Django中执行create database charset=utf8;命令报错:ERROR 1064 (42000): You have an error in your SQL syntax; check the manual that corresponds to your ...
分类:
数据库 时间:
2020-07-18 11:39:41
阅读次数:
133
链接:https://leetcode-cn.com/problems/binary-tree-inorder-traversal/ 代码 /** * Definition for a binary tree node. * struct TreeNode { * int val; * TreeNo ...
分类:
其他好文 时间:
2020-07-18 11:34:31
阅读次数:
66
A - Distance in Tree CodeForces - 161D 题目大意:树是一个不包含任何圈的连通图。树的两个节点之间的距离是节点之间最短路径的长度(也就是边的长度)。 给定一棵有n个节点的树和一个正整数k,找出距离恰好为k的不同节点对的数量。注意,节点对(v, u)和节点对(u, ...
分类:
其他好文 时间:
2020-07-18 11:28:18
阅读次数:
57
链接:https://leetcode-cn.com/problems/unique-binary-search-trees/ 代码 class Solution { public: int numTrees(int n) { vector<int> f(n + 1); f[0] = 1; for ...
分类:
其他好文 时间:
2020-07-18 11:25:21
阅读次数:
56
此题和之前的剑指offer32-I、II.从上到下打印二叉树大致相同在BFS的基础上只是添加了一个重排序的过程。具体代码如下: 1 /** 2 * Definition for a binary tree node. 3 * struct TreeNode { 4 * int val; 5 * st ...
分类:
其他好文 时间:
2020-07-18 11:18:07
阅读次数:
58
1 class Solution { 2 public int searchInsert(int[] nums, int target) { 3 int length = nums.length; 4 int left = 0, right = length - 1, ans = 0; 5 whil ...
分类:
其他好文 时间:
2020-07-18 00:57:17
阅读次数:
92