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..?

Monday, December 17, 2018

Mathematical vs. Computational approach II - linear algebra

I was solving LeetCode #874 - Walking Robot Simulation. (Yes, I am almost done with solving Easy level problems!) Here you need to be able to turn the direction of robot motion, out of four possible orientations: North / South / East / West, or simply ±X and ±Y. What came to me first was purely mathematical, or linear algebra: rotation matrix. For clockwise rotation, you can use R(-90°) where R is the 2x2 unitary matrix corresponding to CCW rotation, and R(90°) for opposite rotation.

But there are only four direction vectors: (±1, 0) and (0, ±1). Rotation means circulating the four either with increasing or decreasing indices. R(90°) is equivalent to cyclic (1,0) → (0,1) → (-1,0) → (0,-1) → (1,0).

The mathematical logic using rotation matrix can generalize the vector rotation into any angle. In that sense it is a fundamental principle. But the special case of direction vectors only along x or y axis doesn't even need any math, except that you denote the direction vectors with proper tuple (set) of coordinates. The latter is obviously much simpler and quicker to calculate, thus optimal for this particular problem.

To me the distinction between mathematical and computational approach in the present case goes far beyond a question of which is faster or better. I feel that I am seeing a deep philosopical dichotomy between pure and applied knowledge (or science). The former type of people, or principle-based thinkers may not understand or like those with the latter, and vice versa. The gap between the two regime might be far wider and deeper than we assume.

Sunday, December 16, 2018

Certified Solidworks Associate & Professional

I have 10 years of professional experience using Solidworks. In constructing large-scale custom-designed cryogenic UHV (ultra-high-vacuum) experimental probe stations. Which involves thousands of components of varying length scale from fraction of inches to a few feet, as well as actual assembly / testing / trouble-shooting of each components into intermediate modules, and finally to a final station.

Dassault Systèmes, manufacturer of 

Solidworks, offers certificate exam for user proficiency in three levels: certified associate / professional / expert, of course in increasing difficulty. According to Solidworks, as of today, there are 226007 associate, 98971 professional, and 3642 experts worldwide.

I was long aware of the the certificates. I also already reached levels to pass professional exams with little additional preparation, but only recently attempted.


In my experience, associate exam was quite easy. Parts were relatively straightforward to design. I finished the exam in a little over half of the given time. But professional exam demanded much higher level of proficiency. You have to pass three sections: parts / configurations / assemblies. The later two sections were not that hard, although you need to be familiar with minor functions. But parts section was quite difficult. In fact I failed the first attempt particularly because I had not much experience with equation-driven designs. I had to do a bit of practice, and passed the second attempt.

I am just one of the ~100K professionals. But I suspect only a few of them has a Physics Ph. D. degree from Ivy League university. Furthermore, I feel almost obligation toward challenges when I see an immediate next goal: a certified Solidworks Expert. There are a few prerequisites and I need some self-training for it. But I hope that I post expert certificate soon.

Saturday, December 15, 2018

Unbearable nuisance of a tiny sub-icon to Google Chrome icon in the Windows task bar

There are tiny things that I can't bear with, even in cases I can just ignore. Simply I can't. I must figure out why or what's happening and resolve. Here is an example.

Sometimes I found a small sub-icon is attached at the right bottom corner of Google Chrome browser icon (under Windows, but I believe it should be platform-independent) like this -


I remember to have seen this a few times in the past. My past web search into the reason always failed probably because in the first place I failed to figure out the right search keyword. The fact that I couldn't figure it out was far more annoying than the appearance of the sub-icon itself.

Today I finally figured out by accident. Not by web search. It seems to happen when more than one user account is logged into the Google Chrome browser.


So click 'Manage people' and remove unnecessary users. Then the sub-icon disappears. So great to see that it is gone.

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...