1、分片和副本机制 1、index包含多个shard 2、每个shard都是一个最小工作单元,承担部分数据;每个shard都是一个lucene示例,有完整的建立索引和处理请求的能力 3、增减节点时,shard会自动在nodes中负载均衡 4、primary shard和replica shard,每 ...
分类:
其他好文 时间:
2020-04-06 10:03:16
阅读次数:
83
要求 给定一个链表,对于每两个相邻的节点,交换其位置 示例 1->2->3->4->NULL 2->1->4->3->NULL 实现 1 struct ListNode { 2 int val; 3 ListNode *next; 4 ListNode(int x) : val(x), next(N ...
分类:
其他好文 时间:
2020-04-06 09:59:36
阅读次数:
53
Given the node of a binary search tree, return the sum of values of all nodes with value between and (inclusive). The binary search tree is guaranteed ...
分类:
其他好文 时间:
2020-04-06 09:50:46
阅读次数:
73
Given a list of positive integers nums and an int target, return indices of the two numbers such that they add up to a target - 30. Conditions: You wi ...
分类:
其他好文 时间:
2020-04-06 09:49:05
阅读次数:
76
题目 输入一个整数数组,实现一个函数来调整该数组中数字的顺序,使得所有奇数位于数组的前半部分,所有偶数位于数组的后半部分。 示例: 提示: 1 exchange(vector& nums) { int i = 0, j = nums.size() 1; while (i < j) { while ( ...
分类:
编程语言 时间:
2020-04-05 22:38:46
阅读次数:
73
AtCoder Beginner Contest 161 第一次打AtCoder的比赛,因为是日本的网站终于不用倒时差了233。 A - ABC Swap 可以直接按照交换后的顺序输出。 #include <bits/stdc++.h> using namespace std; int main() ...
分类:
其他好文 时间:
2020-04-05 15:24:18
阅读次数:
89
传送门 A - ABC Swap #include <bits/stdc++.h> #define ll long long using namespace std; int main() { //freopen("in.txt","r",stdin); int a,b,c; scanf("%d%d ...
分类:
其他好文 时间:
2020-04-05 13:25:36
阅读次数:
69
Given the root of a binary tree, find the maximum value V for which there exists different nodes A and B where V = |A.val - B.val| and A is an ancesto ...
分类:
其他好文 时间:
2020-04-05 12:01:52
阅读次数:
97
首先要知道CAS CAS Compare and Swap,即比较再交换; 区别于synchronouse同步锁的一种乐观锁(是一种无锁算法) CAS有3个操作数, 内存地址,以直接从内存中获取旧值; 旧的预期值A,代码中的旧值; 要修改的新值B 当且仅当预期值A和内存值V相同时,将内存值V修改为B ...
分类:
其他好文 时间:
2020-04-05 09:40:41
阅读次数:
58
题目链接:AtCoder Beginner Contest 161 原版题解链接:传送门 A - ABC Swap 这题太水,直接模拟即可。 1 #include <iostream> 2 using namespace std; 3 int main() { 4 int a, b, c; 5 ci ...
分类:
其他好文 时间:
2020-04-04 22:54:54
阅读次数:
100