Monday, April 15, 2019

LeetCode - solved 150 medium level problems

A progress report: I solved 100 medium level problems of LeetCode on 3/8, and today finished 150th. Took 38 days to clear the 50 problems. ~1.3 per day on the average. Not too bad. There were one or two problems that I couldn't figure out myself after a few days of attempt, so that I consulted official solution (I still don't fully understand them though). Purely my effort otherwise.


Saturday, April 13, 2019

Project Euler #233 - 10 months on a problem

I posted an article about a Project Euler problem on which I spent 41 days for a record. It was about two months after I seriously started solving PE. Now that I have just past one year mark, I have a far outstanding record: 10 months on #233. In fact (I keep progress record in Gmail so I can precisely track) I spent ~8 months without significant progress, and spent a month on a logical progress with a lot of test & research, finally into an answer. Unfortunately it was incorrect. So I consulted Project Euler Forum (never before for this problem), which had intermediate test cases I could check my reasoning / code against. It turned out that my logic was built upon a fundamentally wrong assumption, which I could have easily confirmed with brute force code for simpler cases instead of pure reasoning. Anyway I had to re-build logic. The underlying rule was not hard to figure out if one started with concrete evidences obtained from simple brute force codes. From that point, it took me two more days to write almost new code to get a correct answer. When I hit the answer correct, the moment I waited for 10 months, I felt empty than thrilled. Maybe I was overly exhausted by this single problem. By the number of  attempts that didn't work. Nevertheless I have never thought of giving up. I rather am the more attracted by other problems of similar or higher difficulty ratings (#233 has only 70% difficulty). I only wish I have weeks and months of free time. So that I can work on these problems 24/7. As infinite persistence is always ready by my side.

Friday, March 8, 2019

LeetCode - solved 100 medium level problems

On 2018 Christmas I posted an article upon finishing all easy-level problems of LeetCode. I said I will keep solving medium level ones. I did, and today I solved 100 out of 496 (as of this writing; LeetCode hosts weekly contest and add the problems to the list afterwards). It's been about 73 days since 2018/12/25 in which I have solved 24, but I was away on vacation, and I spent late December + early January mostly on becoming Certified Solidworks Expert, so I solved additional 76 problems in about a month and a week. Two problems per day on the average.


I solved medium level problems in descending order of acceptance. Meaning that I started from the easiest problems to progressively harder ones. But medium was medium. Significantly more difficult than easy ones. Easy problems were mostly about the basics; straightforward questions with good understanding of key data structure & algorithm. Medium problems went one step further in, demanding application (not too hard though) of basic concepts. One has to think quite a bit to decipher the required logic, implementation is more complicated and prone to mistake, and the final codes are longer. Moreover, there are algorithm topics of commensurate difficulty such as dynamic programming / Disjoint set & union find / Bitwise manipulation / stack / etc. I had to learn and review them carefully, so I couldn't solve 10 problems a day like I did with easy ones. However, the harder the problems are, the greater the thrills of solving them. That is the ultimate, undeniable attraction intellectually challenging questions in math / physics / coding have to offer.


I keep most of the source codes I wrote and associated thought process in my Gmail account for convenient re-visiting in the future. So far I am the more and more fascinated by these coding problems. Will keep it up!


Wednesday, February 20, 2019

Project Euler - level 10

Project Euler (PE) is a popular online math and coding challenge site. Compared to other CS-style coding-oriented sites such as HackerRank or LeetCode, PE problems heavily involve mathematics like number theory and geometry. PE problems are 'hard' in the sense that finding the governing math equations is not the end of the game. It typically asks you to count the number of integer solutions of the equation, which involves additional layer of number theory skills. One can brute force count, but it will take millions of years. Anyway, lying at the intersection of math and coding and math with comparable proportion, this site was exactly for me.

I started solving PE problems back in April 2018 for Python coding practice. The problems were easy at the beginning. I could solve more than 10 problems a day. But the problems became progressively difficult to solve. Instead of being distracted, I was the more fascinated by the challenge. Soon I was completely captivated by thinking of the solutions literally all day long. I was solving the problems while driving, taking showers, in the bed, in the bathroom; essentially whenever I could. I even completely stopped listening to podcasts while commute driving just to solve PE problems.

In the mean time I ran into an interesting article in Quora, questioning 'who are the people who solve 200+ PE problems?'. It had responses from people who actually solved over 200 problems, one of whom was contacted by and worked in Google. What a stimulus. Another reply claimed solving 200 problems in 4 months. I set the same milestone as my goal.

In the end, I passed the finish line in 115 days, a bit short of 4 months (progress summarized in GitHub repository). Note that I wasn't as committed before I set my goal. There were a few days in which I haven't tried any problems. Therefore I must have spent significantly less than 115 days in reaching 200. Due to the increasing difficulty, I had to reduce sleep to spare more time on the problems. I am proud that I solved all 200 problems without discussing with anyone else nevertheless.

I kept solving PE problems since, although at much slower pace after 200. And just yesterday I reached level 10 by solving another 50 problems in about 6 months. Roughly 2 problems per week. Only 1153 people in the world reached level 10 in the last ~17 years, out of ~880k registered users. Definitely a token of achievement, for tenacity and persistence.


After solving 60~70 problems I started saving my Python code. Furthermore, after solving ~100 problems, I have recorded the entire thought process including key insights and the points where I was stuck or made mistakes, along with pictures of handwritten paper notes. I don't publicly share any of them in accordance with PE policy. Contact me personally if I can be of help.

I will keep moving forward. Let's see how far I can go.

Thursday, January 24, 2019

Certified Solidworks Expert

About a month ago I posted an article on Certified Solidworks Professional (CSWP). There I wrote that my ultimate goal is obviously reaching the highest level. Last Sunday I achieved the goal: I became the 3692nd Certified Solidworks Expert (CSWE) in the world. For comparison, there are approximately 100,700 CSWP and 230,000 CSWA (Associate) worldwide.



Expert level has a massive set of pre-requisites. On top of the CSWP, one needs to clear four of five advanced topics: Sheet Metals / Weldments / Drawing Tools / Surfacing / Molds. In other words one has to master nearly all key frameworks of mechanical design Solidworks has to offer. Then you are qualified to take the expert level exam.

For the expert level exam you have a 4 hours time frame without break to solve 20 problems. All of them are assigned 10 points, unlike other exams with varying points depending on difficulty. 160 points (80%) is the minimum passing grade. There were two multiple-choice questions, in contrary to the guide info saying no MPC. Half of the questions were on topics already covered by CSWP / CSWPAs but were significantly more difficult and/or demanded deeper understanding as well as mastery.

Below is the brief summary of my progress from the very beginning -

2018/11/08 : CSWA passed
2018/11/12 : CSWP segment 1 failed, 2 & 3 passed
2018/11/25 : CSWP segment 1 passed (CSWP completed)
2018/12/26 : CSWPA-SM (advanced - sheet metal) passed
2019/01/01 : CSWPA-SU (advanced - surfacing) failed
2019/01/09 : CSWPA-WD (advanced - weldments) passed
2019/01/13 : CSWPA-DT (advanced - drawing tools) passed
2019/01/16 : CSWPA-SU (advanced - surfacing) passed
2019/01/20 : CSWE passed

Until the end of 2018 I was all by myself; I took the exams with my prior experience + Solidworks official tutorial + a bit of Google search for video lectures on topics required by each exam for which I was not familiar with. At the beginning of 2019, however, I came across a extremely helpful LinkedIn lecture series by Gabriel Corbett. His videos cover virtually all sketch / parts / assembly / drawing functionalities systematically one by one. More importantly, he provides certification lectures that specifically targets each exams. (He even mentions in his video that he was involved in building and beta-testing Solidworks exams!) He pinpoints a number of tricky details that are hard to learn from official materials, and that are critical in solving those problems. He does a great job by helping people pass the exams easier and quicker, but he also shares numerous tips and know-hows that are not related to the exams. I learned so much from him. His lectures definitely helped me pass professional level exams fast.

For expert exam, I practiced with a book titled Certified SOLIDWORKS Expert Preparation Materials by Paul Tran. This book is specifically written for expert exam preparation. A bit expensive thinking of its volume, but you will find that the book is worth the money since there are little resources about the expert exam. Solidworks does not offer any test exam for the expert level to keep it the most challenging, and there are only less than four thousands of CSWE in the world. Where else can you get a real peek into the exam? Dassault Systemes (Developer company of Solidworks) should not like this book which reveals most of the heavenly secrets. From test taker's perspective, on the other hand, this book is the only and the must. The author shows you pretty much of everything you will see in the actual exam.

During the last 2~3 months of Solidworks self-study, I found a few interesting 3D modeling challenge sites, such as Solidworks model mania. Although I stepped on the top of the podium now, I am still hungry for further challenges. I want to further practice building models involving surfacing techniques. Just for fun for now.

A tip : from my experience, the exams were not much different between the first and the second time. Try taking screen shots for review if you think you can't make it at the first attempt, like what I did every time.

Tuesday, December 25, 2018

LeetCode - completed easy level problems

LeetCode is one of the popular coding practice online sites. One can find coding interview questions from big IT / financial companies, and submit their code for each questions to compare code performance against statistics from thousands of other coders. As of this writing there are 957 problems available; easy / medium / hard difficulty being roughly one third respectively. In order for the submitted code to be accepted, it has to pass all (as many as hundreds) test cases of varying length and complexity, within reasonable amount time. One will see 'time limit exceeded (TLE)' error if not. So solving a problem means [1] implementing [2] efficient algorithm.

Earlier this year I started Python coding practice with LeetCode. Back then with rudimentary coding skills I managed to solve a few easiest problems after fixing the code many times due to TLE. It was so annoying to have my code denied by invincible extreme test cases. So I gave up within a few weeks. I switched to a far more interesting challenge site - Project Euler. LeetCode has primarily computer science style problems, whereas PE heavily involves mathematics which I like. I learned a lot about basics of Python by comparing my PE code with others. After about 4 months of serious dedication into Project Euler with Python (I will write about this later) I retried LeetCode. The problems now seemed far easier. A lot of codes I wrote for easier problems passed all test cases pretty quick. What a surprising improvement.

Then I switched back to LeetCode. Time permitting, I could solve 10 problems within 3~4 hours in one shot, even including the time spent on examining code by other people for subsequent study, and on recording the code and notes (I have most of the codes saved on my Gmail account)! Furthermore, easy level problems felt too easy thus not worth wasting my time and effort. But I decided to be a bit patient. I wanted to cover all major topics and to learn basic code snippets particularly because I am not a computer science major. 

I solved the easy problems one by one with increasing difficulty. Toward the end the problems were getting hard, so recently I could solve only a few per day. And today, on X-mas 2018 (not what I intended), at last I completed all ~240 easy problems available free (about 10% of problems are open to paid premium users, which I plan to solve later all together).


Through the journey I could self-study crucial topics such as array / string / hashing / dynamic programming / binary tree / etc. Out of the key areas, depth first traversing binary trees using recursive algorithm was the hardest to get used to since it requires a highly distinct mode of reasoning. Now that I successfully went through tens of simple examples by myself, I am afraid no more of writing recursive code blocks, while I definitely was in the past. Truly a big step forward.

In LeetCode, you can see other's code in the discussion board for each problem without having your code accepted. But I would like to emphasize that there were less than ~5 cases out of ~240 problems where I did that. Those were mostly when the problem description was unclear, for which a lot of users had strong complaints. Except for those, I am proud of myself finishing easy problems all by myself.

Now I am walking into medium level problems. Hope I don't give up until I finish all of them, and post the news in the near future.

Thursday, December 20, 2018

Unique features of Houston and the downtown

Recently I visited Houston, TX for the first time (been in Texas though). I observed a few interesting points in downtown, which I haven't seen or I'm not used to in anywhere else in the US.

[1] One-way streets
So many (or most of the) streets were 4~5 lanes wide but one-way. It was so wide to allow double lanes of street parking on BOTH sides, still leaving spaces for two-way traffic in the middle if it were Manhattan. I stayed in downtown only during the weekend, so have no idea on the traffic conditions during weekday. One-way streets should suffer from much less issues associated with intersections / traffic lights / left turn, so one-way-dominant could be a better scheme for busy downtown. Anyway I haven't seen any city streets that wide mostly running one-way. Isn't one-way street typically for narrow roads in old cities?

[2] Parking space
Houston downtown had many blocks only for parking. There were many parking only buildings around, up to 10~15 stories high. Even more interesting thing was open parking lot (no building or whatever) occupying a whole block. Where else in other big US cities can you imagine so many of a whole building or even open parking lot right in the middle of high-rise buildings. Later I learned that Houston is the only city in the US without 'zoning' regulation, meaning no governing set of rules on allowed facilities zone by zone. Or parking building is such a lucrative business contrary to my expectation, probably because of negligible maintenance cost and stable cash in-flow, only prohibited by zone control?

[3] Traffic against passenger pickup
I noticed this immediately upon leaving the Houston airport (IAH) terminal C to get a taxi. The traffic was moving to my left! It means that passengers need to cross the street to get on board. Not only inconvenient, but also accident-prone. The pick-up / drop-off area was larger on the other hand, so it was not as messy as it could have been in other US airports, but I could not figure out the reason that the airport traffic was designed in an opposite sense of rotation (when looked down from the sky). For valet maid to stay away from the building, not to be in the lobby area for their 'master'? More surprisingly, some downtown hotels had similar traffic pattern in the entrance area. Apparently Houston-specific way of thinking. I am truly wondering why.

[4] Toothpick
Many of the restaurants I visited had a bucket of toothpick ready for pickup in the reception / counter area. Much higher frequency than any other cities. Why..?

Philips SAECO Xsmall espresso machine repaired

I have a SAECO Xsmall espresso machine. I bought it in Dec 2014, and brewed 2~3 cups of espresso per day on the average over the last 6 year...