Optiver coding hackathon is like marathon training

Hi Ashish,

Looking back at the coding tests we did together, I feel it’s comparable to a form of “marathon training” — I seldom run longer than 5km, but once a while I get a chance to push myself way beyond my limits and run far longer.

Extreme and intensive training builds up the body capacity.

On my own, it’s hard to find motivation to run so long or practice coding drill at home, because it requires a lot of self-discipline.

Nobody has unlimited self-discipline. In fact, those who run so much or takes on long-term coding drills all have something beside self-discipline. Self-discipline and brute force willpower is insufficient to overcome the inertia in every one of these individuals. Instead, the invisible force, the wind beneath their wings is some forms of intrinsic motivation. These individuals find joy in the hard drill.

( I think you are one of these individuals — I see you find joy in lengthy sessions of jogging and gym workout. )

Without enough motivation, we need “organized” practice sessions like real coding interviews or hackathons. This Optiver coding test could probably improve my skill level from 7.0 to 7.3, in one session. Therefore, these sessions are valuable.

any zbs in algo questions@@

I think Rahul may have a different view, but I feel some of QQ questions qualify as zbs, but very few of the algo tricks do.

In contrast, data structure techniques are more likely to qualify as zbs.

Obviously, the algorithm/data-structure research innovations qualify as zbs, but they are usually too complex for a 45-min coding interview.

## Y revisit old algo Qn #Kyle

I find it hard to be interested in previously solved problems. I think many fellow developers (not only those in a hurry) simply skip such problems. However, we are not so “good at” these problems actually.

  1. Reason – there are often insights and recurring patterns in an old problem, that require slow and repeated digestion. Solving it quickly is usually not enough… 囫囵吞枣.
  2. reason — our solutions are often sub-optimal.
  3. reason — even if our solutions are optional, there are still very smart alternative solutions out there we don’t know.
  4. reason: xRef between Questions is more important than learning tricks@new questions
  5. reason — we forget.
  6. reason — with a simple tweak, the problem can become a new problem. How well and how fast we can solve the modified problem depends on our insight into the original problem.

Therefore, I feel folks tend to trivialize some well-known problems and fail to learn enough from them.

  • Well-known doesn’t mean well-understood.
  • Well-known doesn’t mean simple.
  • Well-known doesn’t mean restricted to its known form.

Revisiting old problems is boring to many programmers, but often feels easier (more comfortable, relaxed, gentle, less aggressive), more satisfying (rewarding) than tackling frontier problems. I don’t get tired easily when revisiting old problems. If you are like me, then it could be more beneficial than tackling new problems.

However, my visible progress is much slower in terms of #problems solved per week. I think Kyle also pointed out something related to this.

–1% frontier; 99% revisit
Now I think it’s OK to spend most of my coding drill hours on revisit of old problems. Many  are half-solved.

CIV: subOptimal $$valuable solutions#CSY

My friend Shanyou consistently holds a position like “I don’t need to find those better solutions (forget the “optimal”). If my solution is brute force or non-optimal, at least it works, so it will be good enough for many interviews and good enough for my coding drill. Many candidates can’t find even a brute force solution in the given time, so if I strengthen my capabilities to this level it’s valuable.

Admirable !

That’s inner strength — 定力
That’s much-needed focus
That’s undervalued realism
That’s celebration of every progress
That’s a pat on our own back

The all-or-nothing, single-minded pursuit of optimal solution can often wipe out my motivation, joy, satisfaction, self-esteem.

It’s a common and fatal de-motivation to tell ourselves (like XR … ) “There’s no value in pursuing non-optimal solution.” Well there ARE a few:

  1. pride and achievement from completion of a tough challenge
  2. ECT, speed
  3. syntax idioms
  4. self-mastery, internal locus of control, similar to my yoga practice
  5. absorbency — demonstrate to myself; self confidence in absorbency
  6. joy, self-satisfaction — see exactly what I want{cod`drill beside immediate IV #Rahul
  7. … Other blogs provide other perspectives

!! Many published solutions are non-optimal in O()
!! Most solutions out there are non-optimal in terms of concise implementation, even if matching the best solutions in big-O.

Some interviewers only care about big-O and don’t care about too many loops; Other interviews want an elegant, simple solution; The most extreme interviews (Indeed, FB?) score candidates on syntax and code quality too. Which one do you target? Realistically, I would take Shanyou’s target.

Q: your real goals, motivations for coding drill? Absorbency? Burning pleasure? Satisfaction (as Rahul puts it)? Maintaining a hobby?
So defocus can help. The focus on “optimal” creates negativity.

— Many non-optimal solutions are worthwhile.

  • Some of them offer insight into the structure, constraints… but may not offer enough insight to solve the problem
  • Some of them are non-optimal but optimal solutions to modified problems.
  • Some of them are non-optimal but break down the original problem into smaller, familiar problems. This process builds the xRef I need for thick->thin. The breakdown technique can be reusable.
  • Some of them offer reusable techniques
  • Some of them are non-optimal but very short and clever
  • Some of them (my homemade) are unique and innovative … worthwhile achievements.
  • Some of them are good enough for “2nd-tier” coding interviews

 

what could keep up%%coding drill]SG

  • I think the west coast salary would continue to stay high for a few years
  • I may see more examples of older programmers (like me) getting nice offers on the west coast.
  • I am sure to see more friends (in their 30’s) getting nice offers on the west coast.
  • Even in Singapore, there are a few west coast shops including Google and facebook.
  • Rich startups are always attractive to me. I was told some of them use similar coding tests.

Above are the “evidence” that I would see over the next 24 months. But how would I react to them?

Fundamentally, I feel confident I can improve on the algo and coding tests, if I work hard and keep up the effort. Internal locus of control. Self-efficacy

Fundamentally, I always want to stay relevant to the tech economy and various job markets. I never want to be sidelined.

You mentioned the lack of personal time. Big challenge. Another challenge is new job where I must work extremely hard to survive. First X months I would focus on new job and kids. Once I have some free cycles, I will try to resume coding drill.

I don’t know how, but I hope to find a bit of time each month (not each week) working on some challenging questions, or at least review some old questions.

[19]cod`drill: XR discussion #low-end WC jobs

sustainable learning — Am not aiming for efficient learning. Instead, am aiming for sustainable learning. So I prefer problems without known solutions.

Life-long — Coding drill could become a lifelong hobby just like yoga. My tech-learning used to be 10% on coding drill but now 20% on coding drill. Ditto with yoga.

I can see my “west-coast coding IV” performance improving. It is still below the bar at Indeed, but I made big progress at the unfamiliar task dependency problem.

The harsh reality is, we are competing with fresh grads or even interns. Better accept the reality rather than burying our heads in the sand.

There are a large number of easier jobs on the west coast, so perhaps apply remotely and attend the remote coding rounds for practice.

The west-coast CIV is a more /level playing field/ than QQ IV. More objective. Am not negative about it.

coding drill outlasting C++QQ study

Am confident that my coding drill will become a “long-term” hobby like java/c++ QQ, better than c#/quant/swing QQ:

  • Anti-aging.
  • Enjoyable? Yes possible and real if no pressure to time limit no measurable target
  • Not theoretical; more immediate result

I think coding drill may even outlast c++ QQ self-study but crucially my c++ QQ has reached … critical mass ! In contrast, some pure algo interviews are harder for me and I have yet to reach critical mass. For example some DP or graph problems.

prepare Facebook onsite: reasonable pace

Reminders —

  • peek11 and “QQ” tags
  • oq tags in WP
  • trie in py

Q: difficult (medium or hard rating) leetcode problems?
A: some “easy” problems are very challenging and enriching.
A: I feel I should not take on too many problems that feel off-putting. They tend to slow me down, and deflate my motivation.

However, if a problem is a classic and offers valuable insights, then I should probably try it out, then read the solution.

There are too many problems on Leetcode and elsewhere. I have done 100+ but can’t do 200 more until my onsite interview. I think I need to pace myself and accept that I won’t get familiar problems.

Q: should I read solutions on some of the medium/hard leetcode problems after trying for a while without breakthrough?
A: Now I think i should , but I am reluctant to.
Q: focus on coding or pure algo?
A: mostly pure algo… aiming to get the gist of each problem. Implement if fun and simple, but I often get drawn into the implementation and waste my time.
Q: should I consider taking some half-day leaves when I find myself in the mood for coding drill?
A: yes, after discussing with manager.
Q: I used to spend 1 full day on one problem. Of course the best solutions only use 100 lines and will take me 1 hour to understand. Should I avoid that?
A: I think I should, given my limited time.
Goal — improve on my Indeed onsite performance.

motivation4coding drill #intrinsic

I had a short but in-depth discussion with my 17-year old intern about motivation, after he said he solved 10 "medium" leetcode problems on 4 July holiday.

Mostly I was talking, like 80%. He responded 20% of the time.

I started by saying I have been fascinated by the reasons some individuals have such high "motivation to practice", ever since I first noticed my son’s rather low motivation to practice. I tried various means of motivating my son, via "extrinsic motivation" and failed each time. I then said I myself is a good case study as I have periods of high motivation and period of high resistance.

relative importance of intelligence vs effort — IQ reduces the motivation, self-discipline and time required to complete a given amount of practice. IQ also increases the rewards.

Intrinsic motivation — is possibly missing in my son. Any amount of extrinsic motivation is unlikely to make any difference.

Age — is a fundamental factor if you ask me. Students and younger coders intuitively know they have a long career ahead of them, so coding drill can help their career long-term. In contrast, I intuitively know I am unlikely to rise up even if I improve my coding interview performance. My coding drill is helpful to the sustenance of my current career. Yes, I’m in maintenance mode, not growth mode.

cod`drill:YOUR satisfactions@@ wipe_out [def2] #Rahul

Rahul used the word “satisfaction”. (Sometimes I call it “intrinsic motivation” or “joy”.) The satisfaction factor is crucial to absorbency. It enables Rahul to put in so many hours.

Q: What are my satisfactions i.e. intrinsic motivation?
A: discover my own solutions that are reasonably efficient even if not optimal. Almost never elegant and simple.

I don’t mind reading a classic solution in a Real (possibly online) publication but I hate to read solutions in forums as XR does. Those forum posts leads to wipe-out

  • completely wipe out that precious satisfaction.
  • positive feedback loop broken
  • self-esteem destroyed
  • self-mastery destroyed
  • sense of progress wiped out
  • sense of self-improvement wiped out
  • absorbency wiped out
  • I feel /diminished/ and worth-less.
  • i feel hopeless giving up

It’s possible that the forum posters also learned the solutions from publications. But I basically assume they are just so brainy.

cod`drill^quant self-study

quant knowledge used to be a halo, now replaced by coding IV skills like

  • classic generators
  • DP, recursion
  • clever data structures
  • clever graph algos
  • speed coding

In 2012 When I was studying quant in my spare time, I was on a powerful ascent. In the subsequent years, I gradually lost steam. The quant sector was shrinking and market depth was disappointing.

Since 2018, my coding drill feels very relevant, even though the gap behind the strong players continues to be a pain and a de-motivation. When I stop comparing myself with the stronger players, I would feel my improvement in a highly valuable skill

3Hr@knapsack problem..overspent@@

I spent 2-4 hours implementing/refining my own knapsack DP solution — https://github.com/tiger40490/repo1/blob/py1/py/algo_combo_perm/knapsack.py

Many “peers” would consider it overspent. This kind of “conventional” view tend to destroy the precious satisfaction, the wellspring of positive energy.

Some peers complete it in a hurry and move on.

They may not compare it against the comboSum problem … x-ref is crucial to pattern recognition

They may not learn a lot by doing it quickly. I wouldn’t learn much of anything if I do that .. 囫囵吞枣

tech firms value self-motivation in coding drill

I agree with you that to pass FB/Goog/indeed/twitter interviews, we all need to practice for months.

We also need to study the problem patterns during our practice. “Study” is euphemism for a hard long struggle. If we don’t put in a hell lot of focused energy, we can’t absorb the amount of variations and *recognize* the patterns — 从厚学到薄. Without learning the patterns, we will be overwhelmed by the sheer amount of variations in the problems, and forget a lot, as in 狗熊掰棒子.

Q: Why the hell do these firms like to hire coders who practice so hard?
A: My hypothesis:

  • such a coder is typically young — with plenty of spare energy and spare time. An older techie with kids is unlikely to endure such heavy coding drill. We lack spare energy and spare time.
  • such a coder has perseverance and dedication — hard-driving, hard-working, focused, achievement-oriented and determined
  • such a coder is able to tolerate repetitive, boring, lonely tasks — even joy the boredom. I call it absorbency capacity or 耐得住寂寞. This is not only attitude; but an aptitude. My son currently lacks this capacity, but my dad, my daughter and I have this capacity, to varying degrees.
  • such a coder is able to pay attention to details — Getting a program to work on a range of corner cases requires attention to details.
  • such a coder has a quick analytical mind for abstract logical problem solving

In contrast, financial firms target slightly different skills. Their coding questions test language-specific efficiency, language features, or pseudo-code algorithm. Tech firms don’t test these.

Q: what I want{cod`drill beside muscle-build`#Rahul

Hi XR,

I had a brief chat with my young, talented Indian colleague (not the talented intern). He pointed out that he is making progress with his Leetcode real-code drill better than 2 years ago in his Master’s program, because at that time he was in a (job-hunting) hurry and under real pressure. I can identify with him — at present, both he and I feel low or no pressure to improve coding skill so our brains work more efficiently. When I made this point he immediately agreed.

Over-stress inhibits brain capacity; Insufficient stress reduces energy level in the brain.

This colleague always focus on passing Leetcode tests.

You asked me this question —

Q: so exactly what do you want from your coding drill? I won’t answer for my colleague, but my answer is related to him nevertheless.

Indeed if my goal was to pass coding interviews, then my real-code practice is not efficient and overkill. So why am I spending 20% to 33% of my coding drill effort on real-coding rather than reading key ideas… what’s the real reason? I described a fundamental reason in
https://bintanvictor.wordpress.com/2018/08/04/why-our-coding-drills-are-different-fundamental-reason/ but today I will shift focus.

  • A1: I want enjoyment, positive feedback, self-esteem, feeling good about myself …
  • A2: I want some sense of achievement — when you read posted solutions you probably feel you learned something and achieved something. I feel more achievement when I come up with my own solutions, even if not optimal nor elegant.
  • A3: I want visible progress— When you read posted solutions to three common questions, clearly you feel progress. That’s why you aim to study 800 questions. I’m different. I don’t feel significant progress reading posted solutions.
  • A4: I want self-mastery — overcoming many obstacles, similar to yoga. I want to regain control of my spare time and follow some self-directed course.
  • A9: I want to build my mileage — as in driving. Mileage means how many productive hours I have spent on coding problems since age 20. A1/A2/A3 above all help keep me focused on doing more problems. Even with all the joy, achievement and progress, it’s still very easy to give up or lose steam.

[18] CONTINUOUS coding drill #CShi

For years I practiced continuous self-learning on

  • java, c++, SQL, MOM, swing — IV and GTD growth
  • Unix, python — mostly GTD
  • quant

I consider my continuous self-learning a key competitive advantage, and an important part of my absorbency capacity.

I asked a bright young Chinese grad ChengShi. He practiced real coding for months in college. I said “fast and accurate” is the goal and he agreed. A few years into his full time job, he stopped practicing the same. Result? He said for the same coding problem he was able to make it work in 10 min then, but now probably 20 minutes. I think this is typical of the student candidates.

I asked “Do you know anyone who keeps up the coding drill?” He didn’t tell me any individual but gave a few points

  • he believed the only reason for coding drill is job hunting
  • when I said continuous practice all year round will make a big difference compared to practice only when job hunting, he agreed wholeheartedly and reiterated the same observation/belief
  • but he disagrees that continuous coding drill would lead to significant professional growth as a programmer.

 

So he would probably channel his spare energy elsewhere. I think he has other ideas of significant growth, perhaps design of big, fast, scalable, robust systems. However, I stick out my neck to claim that such experience, expertise, zbs … have very limited practical value, almost white elephants.

  • competing in job interviews .. such expertise seldom shines through, unless you come in with architect track record
  • competing on the job .. your experience is a weak ammunition.

At my age, I don’t foresee any “significant growth”.

— CSY discussion
My friend CSY said some students like his son could conceivably focus “all their time” on one skill (coding drill) for fours years in college, so they will “surely” outperform. I pointed out that I am often seen as such an individual, but my speed coding interview performance is hardly improving. Reality? “All their time” may not be more than 20H a week for 10 weeks.

I pointed at the number of Leetcode problems I solved with all tests passed. It grew by up to 10 each year, but a student can solve 10 leetcode problems in half a day.

I gave an analogy of my Macq manager’s (Kevin) weekly slow-jogging, for health not for performance. Consistent jogging like that is great for health. Health is more important than athletic performance. I said jogging and my coding drill are life-style hobbies and recreations.

 

our coding drills r different: fundamental reason #le2XR

Fundamentally, one chooses how to practice based on past interview experience of his own, not hearsays.

Question for you — how many times in the last 18 months did you get a coding interview that required 30+ minutes per question?

A: about 20 out of 25 positions in my recent experience, not including a BGC-partners onsite when they gave me 4 different questions but each 20 minutes only.

Most of my coding rounds are hackerrank/codility or over weekend.

  • Now I think for you the answer is 10% (but did you include those hacker rank tests?)
  • Now I think for you, mostly you don’t need to compile ! That’s why you call them “algorithm questions” rather than coding questions.

Even if I persuade you on the importance of edit-compile-test speed, or the value of python, sooner or later you would doubt “Really? How come I seldom need to write real code so fast in an interview?”. You would eventually stop practicing with real-code and refocus on pure algorithms, by reading key ideas behind common questions.

If you spend hours of focused energy writing real code as practice, and feel worn out, your own, personal experience would eventually kick in and remind you that it’s not worth it.

Conversely, if I were to follow your method to memorize key ideas only, my personal experience would soon shout out — “Take a step back and look again, you are already pretty fast coming up with data structure and algorithm ideas, but your REAL weakness is implementing them — too slow !”

I listed all recent interview episodes in tabular format — https://bintanvictor.wordpress.com/2018/04/28/some-worthwhile-coding-iv-experiences/.

  • 100% of big tech companies require at least one coding question lasting more than 30 minutes.
  • 100% of big buy-side shops require at least one coding question lasting more than 30 minutes.
  • More than 50% of investment bank jobs also require it.
  • For the other c++ financial companies (the so-called “third party” players) like Bloomberg, exchanges, brokers, market data providers, about 80% of the jobs require it.

[18] confidence-build`:another reason y I don’t look@answer

Update — my view was overridden by recent IV experiences. In math problem solving, I studied solutions then built my intuition. My peers actually do the same with algo challenges. They become very confident this way.

–confidence-build`:another reason y I don’t look@answer

Hi XR,

Just to share some minor thoughts.

I solved many “hard” leetcode problems and also the 25-horse puzzle without peeking at answers. These problems are non-trivial, and my solutions are usually efficient but not easy to understand. They are part of a tiny but growing wellspring of technical confidence. They reinforced my self-image of analytical mind. Similarly, CSDoctor Wang often shows a healthy self-image of technical competence, based on many successful experiences. It’s hard to feel confident without experience, simply by reading other people’s answers. (Experience is not that effective at building confidence — we could get a string of unsuccessful experiences … but personal experience is usually the most important factor.)

Also, these problems gave me confidence during non-technical interview, so I could say with conviction that

I am confident with algorithms + data structures even though I’m not the best. I solved more than 20 of the hard leetcode problems on my own, without reading any discussion.

I won’t have the conviction to say the same if I mostly read other people’s solutions.

I sometimes give this long answer to the behavior question “Q: tell me your strength and why”

A: The best comp science students might have good answer to, say, 30% of a question pool including familiar and novel problems. I’m slightly below their standard. However, if the question pool consists of only familiar problems like Leetcode problems, then they would be much stronger than me since I don’t have very high mileage on Leetcode and similar sites. If you want to benchmark me then please pick highly non-standard questions. I am fairly good at creating original algorithms.

Some naysayers would cast doubt — Having solved those problems years ago doesn’t mean he can solve them now. Well, you can say the same about any skill, but we know that once the “circuitry” is wired up in our “system”, the problem solving skills are enhanced. A Programmer who has never solved these problems independently is clearly weaker.

coding drill:LASTING value4family-well-being]U.S.10Y

This blog post is poorly structured, but let’s not spend too much cleaning it up. Not worth it. Most of the content is repeated elsewhere.

See also  the benefits of coding drill in 4 benefits of coding practice #beatFront and Coding drill is anti-aging

Background: for many years until late 2017, I have focused on QQ, and neglected coding tests.

  • If you bring your pure algo skill from 4/10 to 6/10, it will remain around that level, or slightly lower. It will help you with your high-end job interviews for 5-10 years.
  • a lot of “algo skill” consist of key ideas behind the top 100 common coding questions. (I tried about 1/3 of them.) I feel it’s crucial to review the high-value problems to refresh 1 or 2 key ideas for each problem.
    • Note the various max-profit problems look similar but Key ideas are vastly different.
  • If you rely on your work projects, you will remain around 3/10 😦 Your projects won’t train you for those coding challenges in terms of algo, BestPractice, ECT…
  • Only a small part of the required syntax can be practiced but a lot more practice still needed 😦
  • You may think the STL syntax will become familiar naturally, but in reality over a year our projects used no std::map no lower_bound() no sort() no getline() so most of the basic syntax were not developed!
  • One builds the ECT skills (including syntax) with focused practice, outside the day job. No shortcut. Programmers without this “mileage” won’t have this skill. Just like driving or any athletic or artistic skills.

I’m reluctant to break down by “skill” but ..

  1. quick-n-dirty syntax used for coding test — Yes we can remember most of it for 10Y, based on my experience with perl, java, php
  2. ECT — easy to lose the speed. I feel some of the ECT improvement does remain.
  3. pure algo ideas — already discussed above

Low “churn” — most coding questions have remained unchanged for 20 years.

I also realized that my c++ ECT/BP proficiency is different from my java ECT/BP proficiency.

 

4 technique gains { coding drill #技巧提升

An essential review can be good once a while, but over-analysis can reduce our motivation for practice:(

See also my google-sheet on codingIV types and skills required —

Note I don’t target a skill like “passing all Leetcode tests” since those tests require very refined algorithm, but most coding tests focus on just a decent algorithm with normal test cases. See my letter sent to friends about “hard problems”

benefit : quick-n-dirty
syntax+idiom
other part of ECT best practices
Can we remember after X years? 3Y #highly specific items unsure 4Y
Did we improve through past IV? y they are wake-up calls
Can we improve it on the job? actually no rarely slightly
important in short codility IV? crucial y n
important in white board pair-coding? secondary FB only, not GOOG n
important in long take-home assignment? n n y

—-#1 benefit: syntax+idioms. See ##examples@syntax learning via mock coding IV 

I also realized my data structure syntax grasp is insufficient with STL etc. In a timed coding tests I had no time searching online. I feel STL syntax is more messy.

—-benefit: ECT speed of completion.

I was able to complete many timed online tests but still rejected. Still, I did better than before.

—-benefit: best practices — designs, code smells

—-benefit: key ideas (sometimes insight) into a classic problem. A real insight is powerful and reusable. This is mostly useful when we hit a “previous problem”. See https://bintanvictor.wordpress.com/2018/06/09/study-top-100-common-coding-challenges-to-learn-key-techniques/

This is the #1 benefit to XR.

I feel I hit something similar to previous problems about 50% of the time.

wipe_out[def1] @ leetcode+similar sites #XR

wipe-out — I would say this letter described something like a wipe-out experience…

Hi XR,

I may need your advice here. On 23 June I tried one medium level question on LeetCode. (Before Bloomberg interviews, I tried Bloomerg CodeCon website for a few days, with similar experience, but luckily there’s no posted solution 🙂

To my dismay, it took me 4+ hours because I hit lots of “devils in the implementation details”.

  • I dare not submit my code and run LeetCode test cases because I am scared to see tons of failures, a huge discouragement.
  • I am tempted to look at the top solutions, but they are likely much cleaner and better than mine, a huge discouragement.
  • Until I pass all test cases, this question is not done and I would feel guilty to give up. In contrast, my own coding projects can be 50% done and I can leave it as is. I would not feel like a quitter. My own projects have no standard test cases to show I’m 50% done or 90% done. You could say LeetCode acceptance criteria is uncompromising and uncomfortable.

Since I don’t want to see myself as a quitter, I must keep spending hours and hours on this one question. The longer I go, the more tired and I just feel increasingly frustrated that I can’t complete even one question. In my own projects, I could give up without shame or guilt.

  • Even if I were to complete a few questions 100%, I would NOT feel proud because other coders have completed a hundred questions, a huge discouragement.

These discouragements would presumably destroy the precious “burning[1] joy” of coding. This “burning joy” is precious because it’s so hard to get — I need plenty of energy, plenty of quiet time with background music + positive mood to take on tough challenges …. Each hour of coding practice easily consume twice the energy of other type of learning.

[1] burn-or-rot

Here are other drawbacks to LeetCode:

On the Leetcode code editor, I’m unable to run my own small tests until I have a complete solution. In contrast, in my own coding projects, after I have a small module written I can test it and get some immediate satisfaction and make progress on that module. On LeetCode site, I feel like digging and digging in darkness, until I see some light at end of the tunnel.

In conclusion

  1. my skill improvement is not higher than in my own coding practice
  2. satisfaction, positive feedback , self-confidence boost.. is much lower
  3. stress is higher
  4. frustration is higher

Then something hit me — I now realize my son is not as lazy as I thought. As a Chinese father I automatically feel he is not putting the same amount of effort as other kids in his school. But looking at myself .. Am I putting in the same amount of effort as LeetCoders? If we compare to the wrong peer group, we inevitably feel lazy, inferior, inadequate, sub-standard. Such a comparison is not the best way to motivate our kids. It is erosive, hurtful, counter-productive.

In the long run, his classmates who put in more effort doing math problems now may not do better than him. They might do better in standardized exams, but what about university level (no more standardized tests) ?

[18] weekly coding drill plan

  • No need to pass all the tests on leetcode! See tried 3 “hard” leetcode Q’s #tests100%
  • focus on effort, the process of learning
    • not the result like how many questions I have “learned”. Result is unreliable to measure.
  • time slot? mostly weekends. Weekday evenings are probably tough but I did it many times
  • time quantum? Ideally 30-90 min, not 3 hours like in the past.
  • interview format to target?
    1. codility
    2. white-board
    3. take-home?
  • skills to target
    1. pure algo ideas
    2. ECT
    3. syntax
  • select the top 50 classic problems or contrived but popular questions.
  • don’t waste time on questions with many “dislikes”.
  • level? Some past problems are very hard. We could still try those “hard” problems when we feel engaged and confident to grow through them. If too hard, just read the solutions straightaway.
  • question pool? retry — past questions in blog. 温故而知新
  • question pool? Leetcode — if the problem is engaging and classic, even if easy
  • language? py or c++ are easier (than java) to test on my laptops
  • target? 60 minutes a week (better than 0 minutes as in the past). This includes coding, blogging, email discussions
  • how many weeks? 3, starting from late Apr 2019
  • involve friends to increase the engagement — CSY, Ashish, XR, YH, Deepak, Alok, YH,

[19]Cod`drill in our 50’s #CSY

  • I agree that Competing with younger guys on (speed) coding test is like math competition, sports competition, … where experience doesn’t matter. But in our chosen profession, this is reality to be accepted.
  • I agree on Wall St etc there exist decent jobs with modest, reasonable coding tests. I hope coding test do not grow in popularity but I think they will.
  • I agree that you and me are not less intelligent than those strong candidates at coding tests. Your steadfast conviction is inspiring n uplifting. I tend to have self doubts.

I agree that most peers at my age have stopped coding practice.  Some individuals still do. (Deepak is just one example.) I see them as role models just like male yoga practitioners, among a sea of women. Most of my peers see coding drill as a chore, a hard job, a pain in the ass, but I’m different.

For the next 5 to 10 years I hope to find joy in coding drill. Coding drill is like jigsaw puzzle n board games … mental gymnastics to keep our brain young.

There is no shame in revisiting college level subjects.  At age 44 I still studied calculus and passed math exams with flying colors. I am proud of myself, not ashamed of myself. I can probably help my son n my daughters with math till their college. Not many dads can do that.

I will say this again — some technical interviews ask probabilities n SQL. These are college level topics. We just accept and prepare for these interview questions.

[19] camp-out4cod`drill #+localSys

My most effective coding drill is less like hackathon, more like camp-out. My localSys learning is similar.

When I’m in the mood, I know it will last a few hours up to a day, I need to shut out all distractions and capture the momentum until it subsides.

  • weekend assignment: redmart
  • weekend assignment: Jump/iRage orderbook
  • weekend assignment: Houston (quantlab?)
  • weekend assignment: GS tickDB
  • weekend assignment: DRW
  • weekend assignment: nsdq
  • Chartered unix hacking

coding drill≈yoga + weight loss

I had a brief discussion with my friend Ashish.. Coding test improvement is similar to weight or flexibility improvement. I also tell my son about diet control. You probably can think of many other examples.

  • we don’t notice any improvement for a long time. Still, I believe the practice makes me better than before.
    • In the absence of visible progress, Optimism and Faith is important. A pessimist tends to give up before seeing ROTI
  • when we stop the exercise, we are likely to lose part of the effort and continue the downward spiral, esp. with flexibility. See coding drill: LASTING value4family wellbeing for10Y 
  • as we grow older, we feel we tend to lose the competition, even though there’s not enough evidence.
  • it can feel boring and repetitive
  • pair exercise is easier
    • Otherwise, promise a friend

##eg@syntax/idiom learning via coding drill

Syntax (+ some best practice in syntax) is essential in 70% of my real-coding interviews.

There are many memorable exceptions like char-array/int-array, tree, linked list, regex ….. , which require ECT, BP and pure algo, but trivial syntax. Some of them are relatively “hard” on pure algo and my relative strength shines through among Wall St candidates.

Below are some examples of syntax learning via coding drill

  • pointer manipulation in linked graph
  • matrix manipulation
  • pitfall — iterator invalidation
  • pitfall — output iterator hitting end()
  • c++ search within string
  • eg: multi-threading problems —- I had at least 8 experiences in java and c++ (UBS-Yang, Barcap, Gelber, SCB, HSBC, Wells, Bbg thrPool, Pimco + some minor ones in BGC)
  • eg: template, move semantic and placement-new … asked in white-board coding, nothing to do with ECT!
  • eg: lower_bound() means touchUpperBound is all about syntax not algorithm. Revealed via coding interview!
  • See also categories pyECT_nlg, t_c++syntaxTip, t_c++tecniq, T3_stdStr_tagT2_cStr/arr/vector
  • see tags t_c++ECT_nlg
  • c++ syntax requires 3-6 times more learning than python

online solution2algoQ:I always try%%self1st #maxRectangle

https://bintanvictor.wordpress.com/2018/04/07/check-array-of-0-to-n-nasdaq/ is the Nasdaq question. It includes a link to my solution in github. I came up with my own solution. Then I tried your solution found online.

https://bintanvictor.wordpress.com/2018/04/10/check-array-can-be-preorder-bst-walk/ is another interview question. I tried my own and came up with a “better” solution.

If I don’t try my own solution, I would not learn a lot, and I would not have fun implementing my own idea (even if not optimal).

I also find it hard to absorb then remember clever solutions I found online, such as the maxRectangle.

Solving problems myself also grows my confidence when facing unfamiliar problems. I do read online solutions when I have no clue. confidence-build`: another reason y I don’t look at Leetcode answer

By the way, one advantage of my solution is — it can identify the missing numbers, all within O(N) time and O(1) space.