2019-06-12|2019-06-12 arts 第一周

two sum brute force

class Solution { public int[] twoSum(int[] nums, int target) {for(int i=0; i

time complexity:O(n^2)
space complexity:O(n)
one-pass hash table 时间复杂度:O(n)
空间复杂度:O(n)
You’re Not Meant to Do What You Love
You’re meant to do what you’re good at
【2019-06-12|2019-06-12 arts 第一周】https://medium.com/s/please-advise/youre-not-meant-to-do-what-you-love-you-re-meant-to-do-what-you-re-good-at-4e8e6b8e929d
你不想做自己喜欢的事
你打算做你擅长的事
When people learn that I’m a writer, more than half of them will immediately tell me about how they have an idea for a book, or that they need an editor for their autobiography, or that, though it sounds crazy, they are certain they have this one idea that would be a mega-bestseller. Like, one of the biggest books in the world.
当人们知道我是一名作家时,超过一半的人会立即告诉我他们如何对一本书有所了解,或者他们需要一位编辑来为他们的自传,或者说,虽然听起来很疯狂,但他们是确定他们有这个想法,这将是一个超级畅销书。比如,世界上最大的书籍之一。
Most of them haven’t published anything?—?nor are they working on their (supposedly brilliant) bodies of work. They aren’t asking about how to write 5,000-plus words a day. They aren’t strategizing their marketing plans, or researching agencies, or pitching queries to publishing houses.
他们中的大多数人都没有发表任何内容 - 他们也没有在他们的(据说是辉煌的)工作机构上工作。他们不是在问每天如何写5000多个单词。他们没有制定营销计划,研究机构或向出版社提出质疑的策略。
In other cases, writing a few articles a day becomes too much labor; their ideas dry out after a month. They’re frustrated. They’re at odds with themselves. The very thing they love is proving to be a wrong fit. How can this be?
在其他情况下,每天写一些文章会变得太费力; 一个月后他们的想法变干了。他们很沮丧。他们与自己不和。他们喜欢的东西证明是错误的。怎么会这样?
We’re doing people an incredible disservice by telling them they should seek, and pursue, what they love. People usually can’t differentiate what they really love and what they love the idea of. But more importantly, you are not meant to do what you love. You are meant to do what you’re skilled at.
通过告诉他们他们应该寻求和追求他们所爱的东西,我们正在给人们带来难以置信的伤害。人们通常无法区分他们真正喜欢的东西和他们喜欢的东西。但更重要的是,你并不打算做你喜欢的事。你打算做你擅长的事。
We’re doing people an incredible disservice by telling them they should seek, and pursue, what they love.
通过告诉他们他们应该寻求和追求他们所爱的东西,我们正在给人们带来难以置信的伤害。
Imagine an aspiring doctor with a low IQ but a lot of “passion.” That person rightly wouldn’t make it through medical school, and you wouldn’t want them to. And if that person didn’t know better, an inferiority complex would ensue, prompting a lifetime of bitterness and feeling like a failure.
想象一下,一个有抱负的医生,智商低,但很多“激情。”这个人正确地不会通过医学院,你不会想要他们。如果那个人不知道更好,就会产生一种自卑感,引发一生的苦涩,感觉就像失败一样。
Premeditating what we think we’d love to do without actually being in the thick of it is the beginning of the problem, and having too much ego to scrap it and start over is the end. When we try to anticipate what we’d love, we’re running on a projection, an assumption. Almost everybody believes they have the talent to succeed at the thing they really love. Needless to say, not everybody is correct.
预备我们认为我们喜欢做的事情,而不是真正处于困境中,这是问题的开始,并且有太多的自我废弃并重新开始就是结束。当我们试图预测我们喜欢什么时,我们正在进行预测,一个假设。几乎每个人都 相信他们有能力在他们真正喜欢的事情上取得成功。不用说,并非每个人都是正确的。
If everybody did what they thought they loved, the important things wouldn’t get done. To function as a society, there are labors that are necessary. Someone has to do them. Is that person robbed of a life of passion, because they had to choose a life of skill and purpose? No, of course not.
如果每个人都做了他们认为自己喜欢的事情,那么重要的事情就无法完成。作为一个社会,有必要的劳动。有人必须这样做。那个人是否被剥夺了激情的生活,因为他们必须选择一种技巧和目的的生活?不,当然不。
You can choose what you love to do, simply by how you think of it and what you focus on. Everything is work. Everything is work. Everything is work. There are few jobs that are fundamentally “easier” than others, whether by virtue of manual labor or brainpower. There is only finding a job that suits you enough that the work doesn’t feel excruciating. There is only finding what you are skilled at, and then learning to be thankful.
您可以根据自己的想法和关注点来选择自己喜欢做的??事情。一切都很有效。一切都很有效。一切都很有效。无论是通过体力劳动还是智力,很少有工作能够从根本上“轻松”完成。只找到一份适合你的工作,工作不会让人感到难以忍受。只找到你擅长的东西,然后学会感恩。
The real joy of daily work is in what we have to give. We are not fulfilled by what we can seek to please us, but what we can build and offer. It is not fame, or money, or recognition that makes for a thoroughly meaningful life?—?it is how we put our gifts to use. It is how we give.
日常工作的真正乐趣在于我们必须付出的代价。我们不能满足于我们能够取悦我们的东西,但我们可以建立和提供什么。创造一种彻底有意义的生活并不是名利,金钱或认可 - 这就是我们如何使用礼物。这是我们给予的方式。
Think about the structure of the phrase: “Do what you have to give.” What you have to give. What is already within you. Your gifts are not random; they are a blueprint for your destiny.
想想这句话的结构:“做你必须给予的。”你必须给予什么。你内在的是什么 你的礼物不是随机的; 它们是你命运的蓝图。
There’s more to your life than just what you think will make you happy. Your real talents may not stroke your ego as much, but if you apply to them the kind of higher thinking that allows you to find the purpose within them, you will be able to get up every single day and work diligently. Not because you are stoking your senses and stroking your ego, but because you are using what you have.
你的生活不仅仅是你认为能让你快乐的事。你真正的才能可能不会像你那样抚摸你的自我,但如果你向他们申请那种允许你在其中找到目的的更高思维,那么你将能够每天起床并勤奋工作。不是因为你在抚摸你的感官和抚摸你的自我,而是因为你正在使用你拥有的东西。
You are doing what you came here to do.
你正在做你来这里做的事。
tips git 常用命令
  • git关联远程仓库
    git remote add coding https://e.coding.net/rateyu/arts.git
  • 提交art1版本给远程
    git push coding art1
  • 查看远程版本
    git remote -vv
  • 查看本地版本
    git branch
  • 比较本地和远程版本
    git diff art1 coding/art1
share 高并发总览 高并发的原因:
  • 缓存可见性/线程原子性/编译器的有序性
java中的应对
  • java内存模型:volatile/final/sychronized,happen before
  • 互斥锁
性能调优总览
  • 性能测试
  • 性能问题:资源/容器/jvm/网络/应用服务
  • 调优:应用/系统/策略(时间空间)
  • 其他:限流,扩容

    推荐阅读