snapchat_我剛剛在Snapchat獲得開發人員職位。

snapchat

by Jon Deng

喬恩·鄧

我剛剛在Snapchat獲得開發人員職位。 這是我學到的東西,以及它如何幫助您進行求職。 (I just got a developer job at Snapchat. Here’s what I learned and how it can help you with your job search.)

About a year ago, while deployed to Iraq as an Army officer, I started coding for fun. (You can read the whole story here.) Well, after a lot of studying, I landed my first job as a software engineer at Snapchat (Snap) in Venice Beach.

大約一年前,當我作為陸軍軍官部署到伊拉克時,我開始玩得開心。 (您可以在此處閱讀整個故事。)好吧,經過大量研究,我找到了第一家工作在威尼斯海灘Snapchat( Snap )的軟件工程師。

The job search wasn’t easy. I faced a lot of rejections, false leads, and moments of doubt. But the experience helped me develop a mental framework for approaching activities that have a high probability of success over the long term, but a small probability of success on any given day — activities like searching for a first job as a software engineer.

找工作并不容易。 我面臨許多拒絕,錯誤的線索和令人懷疑的時刻。 但是,這些經驗幫助我開發了一種思維框架,以應對那些長期來看很可能成功的活動,但是在任何一天都不太可能成功的活動-例如尋找第一份軟件工程師的活動。

Because finding my particular job was mostly due to a lot of luck (good timing, a fortuitous connection, a good year of funding for startups in Los Angeles), outlining the specific steps I took wouldn’t be super useful to you. That’s because I did the same things that everyone tells you to do:

因為找到我自己的工作主要是由于運氣好(時間安排好,人際關系偶然,為洛杉磯的初創公司提供了不錯的資金),所以概述我采取的具體步驟對您沒有多大用處。 那是因為我做了所有人都告訴您的相同事情:

  • build side projects

    建立輔助項目
  • solve practice problems

    解決實踐問題
  • build your network

    建立您的網絡
  • and apply for a ton of jobs

    并申請大量工作

The actions that you take, and the emphasis you put on each one, will differ greatly depending on your personality and specific circumstances. This said, the mental framework I arrived at during my job search can help you, regardless of your circumstances.

這些動作, 拿的, 把每一個重點,將有很大的不同取決于你的個性和具體情況。 這就是說,無論您的情況如何,我在求職期間所建立的思想框架都可以為您提供幫助。

So I’m going to share the thought process that ultimately lead to my mental framework, while giving you a quick introduction to dynamic programming at the same time. I hope you find this useful ?!

因此,我將分享最終導致我的思想框架的思維過程,同時讓您快速了解動態編程 。 希望這個對你有幫助 ?!

典型的開發人員求職方式 (How a typical developer job search works)

While searching for my first programming job, I read quite a few personal accounts of how other self-taught programmers and bootcamp grads found their first jobs. From their stories, the job search seemed like a very sequential model:

在尋找我的第一份編程工作時,我讀了很多關于其他自學成才的程序員和Bootcamp畢業生如何找到第一份工作的個人記錄。 從他們的故事來看,求職似乎是一個非常有序的模型:

  1. learn to code

    學習編碼
  2. sharpen your skills

    提高你的技能
  3. do some networking

    做一些網絡
  4. work on practice problems

    處理實踐問題
  5. apply to jobs

    申請工作
  6. interview

    面試
  7. get job offers

    得到工作機會

In data structure terms, I pictured it as traversing through nodes of a Linked List.

用數據結構的術語,我將其描述為遍歷鏈表的節點。

I think a common flaw when people recount their memories (especially if they’ve been working as an engineer for a little while), is that they place too much emphasis on cause-effect relationships between the specific actions they took and the outcome that occurred:

我認為人們在回憶自己的記憶時(特別是如果他們已經作為工程師工作了一段時間)的一個普遍缺陷是,他們過分強調自己采取的具體行動與所發生的結果之間的因果關系:

I did A, then B occurred. Therefore, A caused B.

我做了A,然后發生了B。 因此,A導致了B。

Because they have the benefit of hindsight, their outcome seems deterministic. If you only just follow the same steps, you will find a good job.

因為它們具有事后觀察的優勢,所以其結果似乎是確定性的。 如果僅遵循相同的步驟,您將找到一份好工作。

Yes. And no. From my experience, in the long term, if you’re really committed to programming and constantly pushing yourself to get better, you will eventually find a job worthy of your skills (regardless of whether you have a Computer Science degree from a certain school in Palo Alto). The demand for software engineers is real and only growing. But in the short term, the process is super random, and is based on lots of variables that you have no visibility on or control over: company hiring needs, market trends, what hip technologies companies are currently hiring for.

是。 和不。 從我的經驗來看 ,從長遠來看 ,如果您真的致力于編程并不斷推動自己變得更好,那么您最終將找到一份值得您的技能的工作(無論您是否擁有某所學校的計算機科學學位)帕洛阿爾托)。 對軟件工程師的需求是真實的,并且只會不斷增長。 但是從短期來看 ,該過程是超級隨機的,并且基于許多您無法查看或無法控制的變量:公司的招聘需求,市場趨勢,公司目前正在招聘的時髦技術。

When I started searching for jobs in Los Angeles, I sent out a ton of applications, trying to find something — anything. I would have coded in exchange for free food and t-shirts if the anyone had offered me the opportunity. Here are some of the early responses I got:

當我開始在洛杉磯尋找工作時,我發出了很多申請,試圖尋找一些東西- 任何東西。 如果有人給我機會的話,我本可以編碼來換取免費的食物和T恤。 以下是我得到的一些早期回復:

You write nice clean Javascript code. And you were super friendly and we enjoyed talking to you. However, we didn’t see you coding as productively as we needed. To move forward with junior candidates, we need to see an exceptional strong point, and we didn’t see enough of such a strength with you at this point. This means that we can’t work with you.

您編寫了不錯的干凈Javascript代碼。 而且您超級友好,我們很高興與您交談。 但是,我們沒有看到您需要的編碼效率很高。 為了與初級候選人一起前進,我們需要看到一個非凡的優勢,而在這一點上,我們還沒有看到如此強大的實力 這意味著我們無法與您合作。

We all think very highly of you and each enjoyed interviewing you, with the strong belief that your drive, work ethic, and natural curiosity are exactly what we seek in a candidate. Unfortunately, given the timeline of where we are logistically, we are looking for someone with more current experience in front-end development.

我們都非常重視您,并且每個人都喜歡與您面談,堅信您的動力,職業道德和天生的好奇心正是我們在求職者中所追求的。 不幸的是,鑒于我們在物流方面的時間表, 我們正在尋找在前端開發方面擁有更多最新經驗的人員。

Sorry for all the delays. This process is more complicated than I had anticipated. I’ll update you sometime next week as we get closer to making a decision.

對不起,所有的延遲。 這個過程比我預期的要復雜。 我將在下周的某個時候您聯系,因為我們臨近做出決定。

Then [silence] for many weeks.

然后[沉默]好幾個星期了。

Well that was bananas. I did a coding challenge that took me 6 hours and the company can’t even send me a reply email?

那就是香蕉。 我進行了一次編碼挑戰,這花了我6個小時,而公司甚至無法給我發送回復電子郵件?

Getting each of these emails (and the numerous non-responses too) was a very painful experience for me. But never waste an opportunity to learn something useful from hardship. By showing you the thought process that my job search inspired, hopefully this article will give you a tool to optimize the choices you make during the job search, and give you inspiration to continue pushing toward your goal.

獲得這些電子郵件中的每一個(以及眾多無回應的郵件)對我來說都是非常痛苦的經歷。 但是不要浪費機會從困難中學習有用的東西 。 通過向您展示我的求職啟發的思維過程,希望本文將為您提供一個工具,以優化您在求職過程中做出的選擇,并為您提供繼續前進的靈感。

“Pain is inevitable, suffering is optional” -Haruki Murakami
“痛苦是不可避免的,痛苦是可以選擇的”-村上春樹

背包問題 (The Knapsack Problem)

Let me illustrate the steps I took to get to my mental framework, using a variation of a common Computer Science interview question: the Knapsack problem.

讓我用一個常見的計算機科學面試問題: 背包問題來說明為達到我的思想框架而采取的步驟。

**UPDATE: I put my code in a GitHub repo with a small test suite, allowing you to play around with the code and develop a solution yourself.**

**更新:我將代碼放在帶有小型測試套件的GitHub存儲庫中 ,使您可以隨意使用代碼并自行開發解決方案。**

Here is the problem:

這是問題所在:

You have a set of activities that you can choose to do to increase your chances of finding a job. Each activity takes a certain amount of time, but provides some amount of experience. We only have limited time to prepare for the job search, so we can’t do everything. Our goal is to maximize the amount of experience points by choosing the optimal set of activities.

您可以選擇一系列活動來增加找到工作的機會。 每種活動都需要一定的時間,但是會提供一定的經驗。 我們只有有限的時間來準備工作,所以我們不能做任何事情。 我們的目標是通過選擇最佳的活動集來最大化經驗值。

How do you write a function that will choose the optimal set of activities from a list of available activities and a limited amount of time?

您如何編寫一個函數,該函數將從可用活動列表和有限時間中選擇最佳活動集?

解決方案1:蠻力 (Solution 1: Brute Force)

Restating the problem, you want to choose the set of activities that:

重現該問題,您想選擇以下活動集:

  1. Takes an amount of time to accomplish that is less than or equal to the total time you have available

    花費的時間少于或等于您可用的總時間
  2. Maximizes experience points (XP) returned

    最大化返回的經驗值(XP)

The most intuitive way is to use the same algorithm we would utilize in daily life. We would try out various combinations of activities, checking to see if it met our constraint of fitting within a limited amount of time. We would keep searching through all possible combinations and choose the one that maximizes XP.

最直觀的方法是使用與日常生活中相同的算法。 我們將嘗試各種活動組合,并檢查活動是否在有限的時間內滿足了我們的適合性約束。 我們將繼續搜索所有可能的組合,并選擇能最大化XP的組合。

Here is the code for this algorithm:

這是此算法的代碼:

The problem is that this approach is really complex with respect to time, meaning as the size of our input (number of activities we could possibly choose) increases, the amount of time it takes to calculate a solution increases at a much faster rate.

問題在于,這種方法相對于時間而言確實很復雜 ,這意味著隨著我們輸入的大小(我們可以選擇的活動數量)增加,計算解決方案所花費的時間以更快的速度增加。

If we have 6 possible activities, we start by creating every possible combination with a single activity, giving us 6 combinations that contain one activity.

如果我們有6個可能的活動,那么我們首先創建一個可能的組合,并為每個活動提供6個包含一個活動的組合。

Then we have to create all possible combinations with 2 activities. For each of the original 6 combinations, we have to create a combination with each of the 5 remaining activities (you can only do each activity once).

然后,我們必須使用2個活動創建所有可能的組合。 對于原始的6個組合中的每個組合,我們必須與其余5個活動中的每個組合創建一個組合(每個活動只能執行一次)。

Then to create all possible combinations with 3 activities, we have to take each of our combinations containing 2 activities and create a combination with each of the 4 remaining activities.

然后,要創建包含3個活動的所有可能組合,我們必須采用包含2個活動的每個組合,并與其余4個活動中的每個創建一個組合。

Eventually we’ll have something that looks like (6 * 5 * 4 *3 * 2 * 1), which is O(n!). Also, because we sum all the items in each combination every time to calculate the total time and XP, our end time complexity is O(n! * n).

最終,我們將得到類似于(6 * 5 * 4 * 3 * 2 * 1)的值,即O(n!) 。 另外,由于我們每次都會對每個組合中的所有項目求和以計算總時間和XP,因此結束時間復雜度為O(n!* n)

Imagine that instead of running this algorithm on a computer that can execute trillions of operations a second, you have to run it on your limited brain, which actually takes 10 hours (in a very optimistic world) to do a side project to learn a new JavaScript MV* framework.

想象一下,您必須在有限的大腦上運行它,而不是在每秒可以執行數萬億次運算的計算機上運行此算法,實際上這需要10個小時(在非常樂觀的世界中)才能完成一項附帶項目以學習新知識JavaScript MV *框架。

And also instead of a choice of 6 activities, you have thousands of possible things you could be doing to prepare for job search. (Just look up “how to code” on Google).

而且,除了選擇6個活動之外,您還可以做成千上萬種可能的事情來準備求職。 (只需在Google上查找“如何編碼”)。

It is completely impractical to try every possible combination of activities to prepare yourself for job search. The lesson from this example is there is an almost infinite amount of things you could be doing that will increase your chances of finding a job, but you can’t try all of them. You need a better method to determine your optimal set of activities.

嘗試各種可能的活動組合來為求職做好準備是完全不切實際的。 這個例子的教訓是,您可以做的事情幾乎是無限的,這將增加您找到工作的機會,但是您不能嘗試所有這些。 您需要一種更好的方法來確定最佳活動集。

回溯 (Backtracking)

Obviously, as programmers (and hackers ?), we’re going to want to optimize our current solution somehow.

顯然,作為程序員(和黑客?),我們將要以某種方式優化當前解決方案。

Let’s try the BUD approach from Cracking the Coding Interview by Gayle McDowell (an awesome prep resource, even if your job interviewers never ask algorithmic questions).

讓我們嘗試一下Gayle McDowell 撰寫的“ Cracking the Coding Interview”中的BUD方法(這是一個很棒的準備資源,即使您的工作面試官從不問算法問題)。

  1. What Bottlenecks does our brute force solution have?

    我們的強力解決方案有哪些瓶頸

When looking for the bottleneck, we’re usually trying to identify the most complex part of the process, i.e. the n! part of of our O(n! * n) algorithm.

在尋找瓶頸時,我們通常試圖確定過程中最復雜的部分,即n! O(n!* n)算法的一部分。

The bottleneck, or most complex part of our job search problem is the fact that we have to dynamically create many different combinations and try them out. Every time we add another option, we have many more possible combinations to try out.

求職問題的瓶頸或最復雜的部分是我們必須動態創建許多不同的組合并進行嘗試的事實。 每次添加另一個選項時,我們都會嘗試更多可能的組合。

Now I have to admit I kind of led you down a false road. My job search problem, as a variation on the Knapsack Problem, is part of a set of problems called NP-Hard. In short, problems are NP-Hard when there is no known efficient way to solve the problem, or verify that that a solution to a problem is correct. So unless you’re a world changing computer scientist, you’re probably not going to figure out an objectively efficient way to combine all the activities.

現在,我不得不承認,我有點帶你走錯了路。 我的求職問題是背包問題的一種變體,它是一系列稱為NP-Hard的問題的一部分。 簡而言之,當沒有已知的有效方法來解決問題或驗證問題的解決方案正確無誤時,問題就是NP-Hard。 因此,除非您是一個改變世界的計算機科學家,否則您可能不會想出一種客觀有效的方法來組合所有活動。

But that’s ok!!! Sometimes, in interviews and job search, we follow false leads. As long as we learn something from the process, we haven’t really wasted time. Even if we can’t find an overall efficient way to solve the problem, we can still find a more efficient way that we’re currently using.

但這沒關系!!! 有時,在面試和求職中,我們會追蹤錯誤的線索。 只要我們從過程中學到了什么,我們就沒有真正浪費時間。 即使我們找不到解決問題的整體有效方法,我們仍然可以找到目前正在使用的有效的方法。

So let’s move on.

因此,讓我們繼續前進。

2. Is my algorithm doing Unnecessary work or Duplicated Work?

2.我的算法執行不必要的工作還是重復的工作

This is where we can make major gains on our solution.

這是我們可以從我們的解決方案中獲得重大收益的地方。

One thing we should change is that for every possible combination, we have to iterate through all the activities in the set to calculate the total XP and total time from that set of activities. This is duplicated work, because we’re adding up the same values over and over.

我們應該改變的一件事是,對于每種可能的組合,我們都必須遍歷集合中的所有活動,以計算出該組活動的總XP和總時間 。 這是重復的工作 ,因為我們要一遍又一遍地累加相同的值。

If we just saved the total XP and time of the combination in a variable, we could just add the XP and time of each new activity we add to to the total. This would take our solution from O(n! * n) to O(n!).

如果我們只是將組合的總XP時間保存在一個變量中,則可以將添加到總計中的每個新活動的XP時間相加。 這將使我們的解從O(n!* n)變為O(n!)。

This is helpful, but doesn’t fundamentally make our problem too much faster to run.

這很有用,但從根本上不會使我們的問題運行得太快。

What other optimization could we do?

我們還能做什么其他優化?

We’re also calculating a lot of combinations that could not possibly lead to a valid solution. This is unnecessary work.

我們還計算了許多可能無法得出有效解決方案的組合。 這是不必要的工作

For reference here is the list of activities again:

作為參考,這里再次列出活動:

const ACTIVITIES = [  {name: 'side-project', time: 10, xp: 12},  {name: 'algorithms', time: 3, xp: 7},  {name: 'networking', time: 1, xp: 0.5},  {name: 'exercise', time: 2, xp: 1.5},  {name: 'systems design', time: 4, xp: 4},  {name: 'making CSS codepens', time: 3, xp: 4}];

Let’s say we have 8 hours total to prepare for our job search. How would our brute force algorithm check combinations?

假設我們總共有8個小時的時間為求職做準備。 我們的蠻力算法將如何檢查組合?

Based on the order of the ACTIVITIES array, we would first consider a set just including the side-project object. There is no valid solution containing the side-project activity because it takes 10 hours to do and we only have 8 hours total.

根據ACTIVITIES數組的順序,我們首先考慮一個僅包含副項目對象的集合。 沒有有效的解決方案包含副項目活動,因為這需要10個小時才能完成,而我們總共只有8個小時。

But our brute force algorithm (being brute force) doesn’t know that, and will then check every possible combination we can create with side-project.

但是我們的蠻力算法(即蠻力)不知道這一點,然后將檢查我們可以使用side-project創建的每種可能的組合。

So it will check if [side-project, algorithms] is a valid solution. It is not.

因此它將檢查[側項目,算法]是否是有效的解決方案。 它不是。

And it will check if [side-project, algorithms, networking] is valid. It is not.

并且它將檢查[副項目,算法,網絡]是否有效。 它不是。

And it will check if [side-project, algorithms, networking, exercise] is valid. It is not.

并且它將檢查[副項目,算法,網絡,練習]是否有效。 它不是。

See how much unnecessary work we’re doing?

看看我們正在做多少不必要的工作?

What if we could give our algorithm a little bit of intelligence, so it can check if our current state (the activities we currently have selected) can lead to a valid solution? If the activities we currently have selected can lead to a valid solution (specifically, if our selected set of activities takes less or equal time than the total time we have as a parameter to the function) then we keep selecting new activities and checking if they’re valid.

如果我們可以給我們的算法一點智慧,然后可以檢查我們當前的狀態(我們當前選擇的活動)是否可以導致有效的解決方案,那該怎么辦? 如果我們當前選擇的活動可以導致有效的解決方案(特別是,如果我們選擇的活動集所花費的時間少于或等于我們作為該函數的參數所花費的總時間),那么我們將繼續選擇新的活動并檢查是否有新活動是有效的。

If not, we stop and unselect the last activity we selected.

如果沒有,我們將停止并取消選擇我們選擇的上一個活動。

For example, if we have 8 hours total, we will first check to see if a combination containing just side-projects can possibly lead to a valid solution. As we determined before, it cannot, because it takes up more time than we currently have.

例如,如果我們總共有8個小時,我們將首先檢查看看僅包含側項目的組合是否可能導致有效的解決方案。 正如我們之前確定的那樣,它不能,因為它比現在占用了更多時間。

So we unselect side-projects, and try out different combinations starting with algorithms. By checking to see if our current selected activities could lead to a valid solution, we’re avoiding having to check any of the combinations containing side-projects, because they could not possible lead to a valid solution.

因此,我們取消選擇副項目,并嘗試從算法開始嘗試不同的組合 通過檢查當前選擇的活動是否可以導致有效的解決方案,我們避免了必須檢查包含副項目的任何組合,因為它們不可能導致有效的解決方案。

This approach is called backtracking. We check to see if where we are could lead to a valid solution, if not, we go back one step and try to make a different choice.

這種方法稱為回溯。 我們檢查一下我們是否可以找到有效的解決方案,否則,我們將退后一步并嘗試做出其他選擇。

Here is the code:

這是代碼:

This solution implements the two optimizations that we discussed earlier:

該解決方案實現了我們前面討論的兩個優化:

  1. Keeping track of total XP and time so we can calculate it in O(1) instead of summing the entire set every time in O(n)

    跟蹤總XP和時間,以便我們可以在O(1)中進行計算,而不必每次都在O(n)中對整個集合求和
  2. Checking whether our current set will lead to a valid solution before we recursively add a new item

    在遞歸添加新項目之前,檢查當前設置是否會導致有效的解決方案

While backtracking saves a lot of work it doesn’t really reduce the overall runtime complexity of our algorithm. It’s still O(n!), because we’re still recursively checking most possible combinations.

回溯雖然節省了大量工作,但并沒有真正降低我們算法的整體運行時復雜性。 它仍然是O(n!),因為我們仍在遞歸檢查大多數可能的組合。

But implementing the backtracking algorithm has probably given you a clue on how to continue working on the problem. In the brute force solution, we had to assemble and check the entire combination for each possible combination. With backtracking, we get to check if the path we’re on will lead to a valid solution, before we assemble the entire combination.

但是實施回溯算法可能為您提供了如何繼續解決該問題的線索。 在蠻力解決方案中,我們必須組裝并檢查每個可能組合的整個組合。 通過回溯,我們可以在組裝整個組合之前檢查所走的路徑是否會導致有效的解決方案。

Hmmmmm…..

嗯...

Is there a way to consider only whether or not we should add another activity to our set? This would be a much easier problem than trying to create the entire combination at once. It would allow us to break up our hard problem (finding the optimal combination) to a series of smaller problems (deciding whether or not to add a single activity).

有沒有辦法只考慮我們是否應該向集合中添加另一個活動? 這比嘗試立即創建整個組合要容易得多。 這將使我們能夠將難題(找到最佳組合)分解為一系列較小的問題(決定是否添加單個活動)。

動態編程 (Dynamic Programming)

Dynamic programming is a method where we can divide our big optimization problem (what combination of activities should I choose?) into a series of manageable decision problems (should I include this activity in my optimal solution or not?). We divide and conquer.

動態編程是一種方法,可以將大的優化問題(我應該選擇哪種活動組合?)劃分為一系列可管理的決策問題(我應該將此活動包括在最優解決方案中嗎?)。 我們分而治之。

Dynamic programming is a common way to solve NP-Hard problems like the Knapsack problem, and coincidentally also a good way to think about job search. It’s hard to determine what combination of activities will make you ready for job search. There’s no efficient way to find the optimal combination or to check if your current choice is optimal.

動態編程是解決諸如背包問題之類的NP-Hard問題的常用方法,同時也是思考求職問題的一種好方法。 很難確定哪種活動組合可以使您為求職做好準備。 沒有找到最佳組合或檢查當前選擇是否最佳的有效方法。

But it’s a lot easier to break your time period down into individual days and weeks, and try to figure out which activities you should be doing for each small period of time.

但是,將時間段分成幾天和幾周要容易得多,并嘗試找出在每個小時間段內應該執行的活動。

To solve our job search problem using dynamic programming, we break the problem up into a series of smaller problems (how do I optimize a smaller period of time?) and then take the solution from each of the smaller problems and combine them into a larger solution.

為了使用動態編程解決我們的求職問題,我們將問題分解為一系列較小的問題(如何優化較短的時間段?),然后從每個較小的問題中獲取解決方案,并將它們組合為一個較大的問題解。

Sounds confusing? Let’s walk through it:

聽起來令人困惑? 讓我們來看一下:

const ACTIVITIES = [  {name: 'side-project', time: 10, xp: 12},  {name: 'algorithms', time: 3, xp: 7},  {name: 'networking', time: 1, xp: 0.5},  {name: 'exercise', time: 2, xp: 1.5},  {name: 'systems design', time: 4, xp: 4},  {name: 'making CSS codepens', time: 3, xp: 4}];

What’s the optimal solution if we have a total time of t=0 (zero) to prepare?

如果我們準備的總時間為t = 0(零),那是最佳解決方案?

If we have zero time, we can’t do any activities, so return an empty set, [].

如果我們的時間為零,那么我們將無法進行任何活動,因此請返回一個空集[]

Ok, now what’s the optimal solution is we have a total time of t=1?

好的,現在的最佳解決方案是總時間為t = 1?

First, let’s see what activities are possible to do: we can’t do a side-project (time t=10) or study algorithms (time t=3). The only thing we can do is networking (time t=1).

首先,讓我們看看可以進行哪些活動:我們無法進行邊際項目(時間t = 10)或研究算法(時間t = 3)。 我們唯一能做的就是聯網(時間t = 1)。

So we need to decide if adding networking to the optimal solution for time t=0 will lead to an optimal solution.

因此,我們需要確定在時間t = 0時將網絡添加到最佳解決方案是否會導致最佳解決方案。

If we add networking, we come out with a total XP of 0.5, not bad.

如果添加網絡,則總XP為0.5,還不錯。

If we don’t add networking, we can’t really do anything else, so we come out with a total XP of 0.

如果不添加網絡,那么我們將無能為力,因此我們得出的總XP為0。

0.5 is still better than 0, so if we only have a total time of t=1, we should do networking. The optimal solution for time t=1 is [networking]

0.5仍然比0好,因此,如果我們只有總時間t = 1,則應該進行聯網。 時間t = 1的最佳解決方案是[聯網]

What’s the optimal solution for time t=2?

時間t = 2的最佳解決方案是什么?

What activities are possible with time t=2, that we haven’t already considered? Just exercise.

我們尚未考慮的時間t = 2可能發生什么活動? 只是運動。

If we choose to add exercise, which takes time t=2, we no longer have any time to do anything else, so our solution is [exercise], which leads to 1.5 XP.

如果我們選擇增加運動,這需要花費時間t = 2,那么我們將不再有時間做其他任何事情,因此我們的解決方案是[運動],得出1.5 XP。

We compare the optimal solution including exercise (which leads to 1.5XP) and the optimal solution not including exercise (which leads to 0.5XP). Since the solution containing exercise is better, we choose that one (In real life, I also feel that with very limited time, some self-care is always more useful than more prep ?).

我們比較了包括運動的最佳解決方案(導致1.5XP)和不包括運動的最佳解決方案(導致0.5XP)。 因為包含運動的解決方案更好,所以我們選擇其中一種(在現實生活中,我也覺得在很有限的時間里,一些自我護理總是比準備更有用?)。

Now here is where it gets really interesting: What’s the optimal solution for time t=3?

現在,這里是它得到真正有趣的: 什么是 時間t = 3的最佳解決方案?

Again, what activities are possible for time t=3?

同樣,在時間t = 3時可能進行哪些活動?

We have the option to choose from [algorithms, exercise, networking].

我們可以選擇[算法,練習,網絡]。

If we choose algorithms which takes time t=3, we have no time to do anything else, so one possible solution is [algorithms].

如果我們選擇需要時間t = 3的算法 ,那么我們就沒有時間做其他任何事情,因此[算法]是一種可能的解決方案。

If we choose exercise which takes time t=2, we have t=1 time left to do something else? How do we know what to choose for the remaining time?

如果我們選擇運動這需要時間t = 2,我們有T = 1周時間留給別人做一些事情? 我們如何知道剩余時間要選擇什么?

We know the optimal solution for time t=1, is [networking], so we don’t have to calculate it again. We know we can’t do better than the optimal solution for time t=1.

我們知道時間t = 1的最佳解決方案是[網絡], 因此我們無需再次計算。 我們知道,對于時間t = 1,我們不能做得比最優解更好

So one possible solution is [exercise, networking].

因此,一種可能的解決方案是[運動,網絡]。

Again we compare all the possible solutions and see that the best we can do is [algorithms].

再次,我們比較了所有可能的解決方案,發現我們所能做的最好的就是[算法]。

This is the basic structure of a dynamic programming solution: at each amount of time, we test the decision of whether or not to add a specific activity. We compare all possible solutions, and figure out the optimal one.

這是動態編程解決方案的基本結構:在每個時間段,我們都會測試是否添加特定活動的決策 。 我們比較所有可能的解決方案,并找出最佳解決方案。

Solutions for greater amounts of time build upon the optimal solutions for the same problem with a smaller amount of time. This allows us to call the dynamic programming function recursively.

較長時間的解決方案以較少時間的相同問題的最佳解決方案為基礎。 這使我們可以遞歸調用動態編程函數。

For my example I chose to sort the array of activities by the time it takes to complete them (least to greatest). This allows us the quickly determine which items are possible in the given time because they are sorted by time.

在我的示例中,我選擇按完成活動所需的時間對數組進行排序(從最小到最大)。 這使我們能夠快速確定在給定時間內哪些項目可行,因為它們是按時間排序的。

Below is the code:

下面是代碼:

Wooooo! If you made it through that example the first time, then you’re a way faster learner than I am. I hope it was an interesting in finding alternate ways to solve hard algorithmic questions!

! 如果您是第一次完成該示例,那么您的學習速度將比我快。 我希望找到解決硬算法問題的替代方法會很有趣!

Finally, what is the purpose of this series of three examples you might ask?

最后,您可能會問這三個示例系列的目的是什么?

Not only did I stealthily give you some practice working on a question very similar to the ones you might be asked in technical interviews, I showed you the steps that I took to come to my mental framework.

我不僅偷偷地給了您一些練習,以解決與技術面試中可能會問到的問題非常類似的問題,而且還向您展示了我進入心智框架所采取的步驟。

There are an almost infinite combinations of activities you could be doing, and there’s no efficient way to determine the optimal set of activities you should do. A lot of paths don’t lead to a valid solution, just like a lot of job applications and interviews won’t lead to a job.

您可能要進行的活動幾乎是無限的組合,并且沒有有效的方法來確定您應該執行的最佳活動集。 許多途徑并不能帶來有效的解決方案,就像許多工作申請和面試不會帶來工作一樣。

You could try every possible combination of job search activities (brute force), but since we are human beings with finite time, this isn’t an efficient way to arrive at our goal.

您可以嘗試各種可能的求職活動(蠻力)組合,但是由于我們是時間有限的人,因此這不是達成目標的有效方法。

We could optimize our approach by evaluating at each step whether or not our approach will lead to our goal (backtracking). For example, if we are constantly reaching out to third-party recruiters to help us find job leads, and the recruiters haven’t been very helpful in generating interviews, maybe we should backtrack and consider a different activity.

我們可以通過在每個步驟中評估我們的方法是否會實現我們的目標(回溯)來優化我們的方法。 例如,如果我們一直在與第三方招聘人員聯系以幫助我們找到工作機會,而招聘人員在進行面試方面并不是很有幫助,那么也許我們應該回頭考慮其他活動。

Lastly, since job search is not a one day affair, we could try to optimize each day and combine days together (dynamic programming). This way we have a manageable problem to deal with (should I study algorithms today?) versus a really hard one (what should I do for the next month to prepare myself for job search?).

最后,由于求職不是一日游,因此我們可以嘗試優化每一天并結合在一起(動態編程)。 這樣,我們就可以解決一個可管理的問題(我今天應該學習算法嗎?),而不是一個非常困難的問題(下個月我應該怎么做才能為找工作做準備?)。

Finally, I just want to point out that with all 3 approaches, even though they were not objectively efficient, we did eventually reach a solution. While in the middle of job search, it’s really important to remember that in the long term, you will achieve your goal, and to keep pushing forward each day.

最后,我只想指出,盡管這3種方法客觀上都不高效,但我們最終還是找到了解決方案。 在求職過程中,切記從長遠來看,您實現自己的目標,并每天不斷前進,這一點非常重要。

I’m going to succumb to my temptation to give you two pieces of advice from my experience.

我將屈從于我的誘惑,從我的經驗中給您兩個建議。

  1. It’s super hard to judge your own performance during interviews and coding challenges — so just focus on the process. You won’t know during the interview or immediately afterward whether you’re doing well or poorly.

    在面試和編碼挑戰中很難判斷自己的表現,因此只需專注于過程即可。 在面試期間或之后不久,您將不會知道自己的狀況是好是壞。
  2. Success or failure are fleeting and shouldn’t determine your happiness.

    成功或失敗是短暫的,不應該決定你的幸福。

If you’re looking for your first programming job, I hope reading this was useful or at least inspirational for you — look, a talentless duffer like me found a great job! Good luck out there and I’d like to close by sharing the best piece of advice given to me during my job search:

如果您正在尋找自己的第一份編程工作,我希望閱讀這篇對您有用或至少鼓舞人心-看起來,像我這樣的無才干的傻瓜找到了一份好工作! 祝你好運,我想在求職時分享給我最好的建議,以結束我的生活:

“Don’t worry about whether you’re good enough, worry about whether you like programming and whether you’re willing to work hard enough. If you do those two things, you’ll make it.” — paraphrased from Edgar Pabon on the Breaking Into Startups podcast

“不必擔心您是否足夠出色,不必擔心您是否喜歡編程以及是否愿意努力工作。 如果您做這兩件事,就會成功。” —摘自Edgar Pabon在Breaking Into Startups播客中的演講

Thanks for reading, and good luck with your job search!

感謝您的閱讀,并祝您工作順利!

翻譯自: https://www.freecodecamp.org/news/a-dynamic-framework-for-finding-your-first-programming-job-b4eb0605b4f3/

snapchat

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/395827.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/395827.shtml
英文地址,請注明出處:http://en.pswp.cn/news/395827.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

sys.argv

import sysi0 print len(sys.argv) while i < len(sys.argv):print sys.argv[%d]:%s %(i,sys.argv[i])i i1 import sysprint len(sys.argv) for i in range(len(sys.argv)):print sys.argv[%d]:%s %(i,sys.argv[i]) 執行 結果 &#xff1a;E:\MyScript>python sysargs.py…

Docker安裝java-Zookeeper進行操作

Docker安裝Zookeeper下載Zookeeper鏡像 docker pull zookeeper啟動容器并添加映射 docker run --privilegedtrue -d --name zookeeper --publish 2181:2181 -d zookeeper:latest 查看容器是否啟動 docker ps idea提供了一個Zookeeper插件&#xff0c;以供連接Zookeeper服務中心…

java反射獲取注解_Java自定義注解和運行時靠反射獲取注解

java自定義注解Java注解是附加在代碼中的一些元信息&#xff0c;用于一些工具在編譯、運行時進行解析和使用&#xff0c;起到說明、配置的功能。注解不會也不能影響代碼的實際邏輯&#xff0c;僅僅起到輔助性的作用。包含在 java.lang.annotation 包中。1、元注解元注解是指注解…

進程間的通訊(IPC)方式

內存映射 為什么要進行進程間的通訊(IPC (Inter-process communication)) 數據傳輸&#xff1a;一個進程需要將它的數據發送給另一個進程&#xff0c;發送的數據量在一個字節到幾M字節之間共享數據&#xff1a;多個進程想要操作共享數據&#xff0c;一個進程對共享數據的修改&a…

開發人員避免編寫測試的2個最常見原因

This post was originally published on Medium這篇文章最初發表于Medium Writing tests represents one of those few stages of software development that is usually overlooked, even though it may be one of the most important one. Developers mention it and usuall…

java ews_Java---使用EWS 寫個ExchangeMailUtil

依賴包&#xff1a;commons-httpclient-3.1.jarcommons-codec-1.10.jarcommons-logging-1.2.jarjcifs-1.3.17.jar代碼示例&#xff1a;創建MailBean類&#xff1a;import java.util.Date;public class MailBean {public BigDecimal getId() {return id;}public void setId(BigD…

Ilya Muromets(DP or 思維)

Ilya Muromets Gym - 100513F Силачом слыву недаром — семерых одним ударом!From the Russian cartoon on the German fairy tale.Ilya Muromets is a legendary bogatyr. Right now he is struggling against Zmej Gorynych, a drago…

C# 裝箱和拆箱

C#的值類型可以分為在棧上分配內存的值類型和在托管堆上分配內存的引用類型。 1、那么值類型和引用類型能否相互轉換呢? 答案是肯定的,C#通過裝箱和拆箱來實現兩者的相互轉換。 (1)、裝箱 ---把值類型強制轉換成引用類型(object類型) (2)、拆箱 ---把引用類型強制轉換成值…

第五章

學會了開發板測試環境的調試和燒寫android系統。 學到的知識&#xff1a; 一、安裝串口調試工具:minicom 第1步&#xff1a;檢測當前系統是否支持USB轉串口。 # lsmod | grep usbserial 第2步&#xff1a;安裝minicom # qpt-get install minicom 第3步:配置minicom # minicom -…

Angular的后院:組件依賴關系的解決

by Dor Moshe通過Dor Moshe Angular的后院&#xff1a;解決 組件依賴關系 (Angular’s Backyard: The Resolving of Components Dependencies) This article originally appeared on dormoshe.io這篇文章 最初出現在dormoshe.io Many of us use the Hierarchical Dependenc…

node中的Stream-Readable和Writeable解讀

在node中&#xff0c;只要涉及到文件IO的場景一般都會涉及到一個類&#xff0d;Stream。Stream是對IO設備的抽象表示&#xff0c;其在JAVA中也有涉及&#xff0c;主要體現在四個類&#xff0d;InputStream、Reader、OutputStream、Writer&#xff0c;其中InputStream和OutputSt…

新Rider預覽版發布,對F#的支持是亮點

JetBrains一直在改進自己的跨平臺.NET IDE產品Rider&#xff0c;努力使其成為Visual Studio家族產品可承擔職能的重要替代者。于今年四月發布的Rider預覽版&#xff08;EAP 21&#xff09;提供了一些新特性&#xff0c;其中的亮點在于對函數式編程語言F#的支持。\\鑒于這是Ride…

java代碼整合_java合并多個文件的實例代碼

在實際項目中&#xff0c;在處理較大的文件時&#xff0c;常常將文件拆分為多個子文件進行處理&#xff0c;最后再合并這些子文件。下面就為各位介紹下Java中合并多個文件的方法。Java中合并子文件最容易想到的就是利用BufferedStream進行讀寫。具體的實現方式如下&#xff0c;…

正則表達式的一些規則

1.限定修飾符只對其緊前的元字符有效 String rex8 "\\d\\D"; 上式中&#xff0c;只對\\D有效&#xff0c;即有至少有1個&#xff08;1個或多個&#xff09;非數字&#xff0c;\\d仍然只許有一個數字。 2.[1,2,3]和[123]是一樣的轉載于:https://www.cnblogs.com/Sabr…

2016版單詞的減法_在2016年最大的電影中,女性只說了27%的單詞。

2016版單詞的減法by Amber Thomas通過琥珀托馬斯 在2016年最大的電影中&#xff0c;女性只說了27&#xff05;的單詞。 (Women only said 27% of the words in 2016’s biggest movies.) Movie trailers in 2016 promised viewers so many strong female characters. Jyn Erso…

軟件工程博客---團隊項目---個人設計2(算法)

針對分析我們團隊項目的需求&#xff0c;我們選定Dijkstra算法。 算法的基本思想&#xff1a; Dijkstra算法是由E.W.Dijkstra于1959年提出&#xff0c;又叫迪杰斯特拉算法&#xff0c;它應用了貪心算法模式&#xff0c;是目前公認的最好的求解最短路徑的方法。算法解決的是有向…

UWP 雜記

UWP用選取文件對話框 http://blog.csdn.net/u011033906/article/details/65448394 文件選取器、獲取文件屬性、寫入和讀取、保存讀取和刪除應用數據 https://yq.aliyun.com/articles/839 UWP判斷文件是否存在 http://blog.csdn.net/lindexi_gd/article/details/51387901…

微信上傳素材 java_微信素材上傳(JAVA)

public String uploadMaterial(String url,InputStream sbs,String filelength,String filename, String type) throws Exception {try {DataInputStream innew DataInputStream(sbs);url url.replace("TYPE", type);URL urlObj new URL(url);// 創建Http連接HttpU…

SQL Server讀寫分離之發布訂閱

一、發布 上面有多種發布方式&#xff0c;這里我選擇事物發布&#xff0c;具體區別請自行百度。 點擊下一步、然后繼續選擇需要發布的對象。 如果需要篩選發布的數據點擊添加。 根據自己的計劃選擇發布的時間。 點擊安全設置&#xff0c;設置代理信息。 最后單擊完成系統會自動…

碼農和程序員的幾個重要區別!

如果一個企業老板大聲嚷嚷說&#xff0c;“我要招個程序員”&#xff0c;那么十之八九指的是“碼農”——一種純粹為了錢而寫代碼的技術人員。這其實是一種非常狹隘和錯誤的做法&#xff0c;原因么&#xff0c;且聽我一一道來。1、碼農寫代碼&#xff0c;程序員寫系統從本質上講…