扫一扫
关注公众号
ARTS的初衷
Algorithm: 主要是为了编程训练和学习。
Review:主要是为了学习英文
Tip:主要是为了总结和归纳在是常工作中所遇到的知识点。学习至少一个技术技巧。在工作中遇到的问题,踩过的坑,学习的点滴知识。
Share:主要是为了建立影响力,能够输出价值观。分享一篇有观点和思考的技术文章
https://www.zhihu.com/question/301150832
Permutations II
Given a collection of numbers that might contain duplicates, return all possible unique permutations.
Example:
Input: [1,1,2]
Output:
[
[1,1,2],
[1,2,1],
[2,1,1]
]
class Solution {
public List<List<Integer>> permuteUnique(int[] nums) {
return helper(nums,0);
}
public List<List<Integer>> helper(int[] nums,int index){
List<List<Integer>> result =new ArrayList<>();
if(index==nums.length-1){
List<Integer> temp = new ArrayList<>();
temp.add(nums[index]);
result.add(temp);
return result;
}
for(List<Integer> temp:helper(nums,index+1)){
for(int i=0;i<=temp.size();i++){
if(i==0 || temp.get(i-1)!=nums[index]){
List<Integer> temp2 = new ArrayList<>(temp);
temp2.add(i,nums[index]);
result.add(temp2);
}else{
break;
}
}
}
return result;
}
}
Introduction to the Apache Pulsar pub-sub messaging platform
Pulsar目前在Yahoo大规模应用后在2016年进行了开源,现在已经成为Apache开源社区的一部分,他的特点是producer-topic-subsciption-consumer消费形式(Apache Kafka是producer-topic-consumergroup-consumer),另外支持了Propertry和Namespace(地域和命名空间)实现了多租户的功能,最重要的支持多种消费方式,比如独占(Exclusive)、共享(Shared,每个消费者会得到一部分消息,这是kafka不支持的功能)、故障切换(Failover,多个消费者可以同时关注一个topic,但是只有一个消费者能拿到消息,如果ACK异常就消息会自动重试其他消费者,保证”broker”的易扩展性),其中故障切换和独占模式,仅允许一个消费者来使用,比较适应严格按照时间顺序的流用例(Stream)。当然也和Apache Kafka一样支持数据分区(single\round robin\hash\custom)等
从整体上来看Apache Pulsar将高性能的流和灵活的传统队列结合在一个统一的消息模型和API中,这样我们可以不用同时维护RabbitMQ和Kafka
本周周报我成了我最不喜欢的”一条流”,可能态度不够端正,得医