Code Monkey home page Code Monkey logo

awesome-zhangjunjia's People

Contributors

zhangjunjia avatar

Watchers

 avatar

awesome-zhangjunjia's Issues

2020 ARTS

01

algorithm

# https://leetcode-cn.com/problems/combinations/
# 77. 组合
# clarify 不能有重复组合,穷尽所有可能组合
# possible solution 回溯?!
# 
from collections import deque

class Solution(object):
    def combine(self, n, k):
        """
        :type n: int
        :type k: int
        :rtype: List[List[int]]
        """
        result, queue = [], []
        def helper(start, end, num):
            # terminator
            if num == 0:
                result.append(queue[:])
                return 
            for i in range(start, end+1):
                # reduce compute
                if end - i + 1 >= num:
                    queue.append(i)
                    # dfs
                    helper(i+1, end, num-1)
                    # reverse
                    queue.pop()
        helper(1, n, k)
        return result

# https://leetcode-cn.com/problems/permutations/
# 46.全排列
# test case => [], [1], [1,2], [1,2,3]
class Solution(object):
    def permute(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        if len(nums) <= 1:
            return [nums]
        def helper(queue, lst, res):
            if not lst:
                res.append(queue[:])
                return 
            for i, num in enumerate(lst):
                queue.append(num)
                helper(queue, lst[:i] + lst[i+1:], res)
                queue.pop() # reverse
        res = []
        helper([], nums, res)
        return res
# https://leetcode-cn.com/problems/permutations-ii/
# 47. 全排列2
class Solution(object):
    def permuteUnique(self, nums):
        """
        :type nums: List[int]
        :rtype: List[List[int]]
        """
        if len(nums) <= 1:
            return [nums]

        def helper(queue, lst, res):
            if not lst:
                res.append(queue[:])
                return
            for i, num in enumerate(lst):
                if not i or num != lst[i-1]: # 起点一样剪枝掉
                    queue.append(num)
                    helper(queue, lst[:i]+lst[i+1:], res)
                    queue.pop()
        
        res = []
        nums.sort()
        helper([], nums, res)
        return res

review

The Amazon Builder's Library Review

tips

左耳听风:管理设计

share

聊天室高并发架构概要

Paper To Read

这个系列inspired by Paper 阅读记录,目标是今年阅读40篇左右的优秀paper,而且每一篇阅读完后都要做输出总结。

论文阅读的方法参考wangzzu paper read如何阅读科研论文

6W原则:

  • 一句话概括论文内容(论文的核心);
  • 跟这个论文相关的一些数字,比如计算机论文一般都会提到集群规模、qps 等(对论文的观点进行量化);
  • 读的过程中碰到了哪些问题?现在都有答案了吗?(收获最大的地方,它能帮忙我们梳理读论文过程中碰到的知识点)
  • 这个框架/方法有什么优缺点?(深入思考其优缺点)
  • 有哪些类似的框架/方法?(帮助归类,横向对比,从一篇论文扩展到整个细分领域所有相关框架/方法)
  • 哪些思路可以马上应用到我们的工作中去?(在实际中应用)

读3遍原则:

  • 第一遍:也算是通读,第一遍需要对论文整体有个了解,不理解和精彩的地方做标注;
  • 第二遍:精读+深入理解:有问题的地方,通过 Google 、请教前辈各种方式把这个问题搞明白;精彩的地方,抽象提炼一下,做一个记录;
  • 第三遍:从头再读一遍,看下自己是否能够完全理解/明白论文的观点,否则重复1、2步。

资源列表:

消息中间件(Message Queue)

  • RocketMQ的出现是为了解决Kafka什么问题:随机IO、延迟消息、事务消息、有序消息
    • 磁盘顺序写
    • slave读
    • 堆外内存加速写
    • 消息查找和kafka的差别
    • 主从的差别
    • 重平衡
  • Pulsar的出现为了解决Kafka什么问题
  • 微信的MQ出现是为了解决Kafka什么问题
  • 对比GFS
    • follower若append失败,一致性问题
  • 极客时间Kafka专栏给我带来什么问题
    • 改进版二分查找
    • page cache
    • leader epoch
    • why not raid
    • key-ordering策略遇到了partition的扩缩容
    • 精准一次,transaction producer+consumer(read commit)的原理
    • why __consumer_offsets,如何获取最新位移
    • why Coordinator + Controller
    • batch-commit vs flush.messages vs ack.all有矛盾?
  • Kafka常见面试题有哪些/Kafka技术书籍可以总结为哪几个问题
    • 磁盘满了append
    • 高吞吐的秘密(page cache)
    • Controller的出现为了解决什么问题
    • 精准一次语义

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.