ARTS Week 29


This week’s LeetCode problem is 334. Increasing Triplet Subsequence

Given an integer array nums, return true if there exists a triple of indices (i, j, k) such that i < j < k and nums[i] < nums[j] < nums[k]. If no such indices exists, return false.

This problem can be solved using the greedy method. The initial minimum value (minVal) and the second minimum value (secondVal) are both Integer.MAX_VALUE. Next, traverse the array. When nums[i] is less than minVal, update minVal to nums[i]; when minVal < nums[i] < secondVal, change secondVal is updated tonums[i]; if nums[i] > secondVal, it means that there is a triple that meets the requirements of the question. If nums[i] > secondVal` does not appear after traversing the array, it means that there is no triple that meets the requirements.


This week’s Review is for the following article: Write Shitty Code — why you should and feel good about it

Usually it means spending more time now to make the code better for some future state of the world. In software we rarely know what the future holds. Usually uncertainty is caused by:

  • Not knowing the technology
  • Not knowing the business
  • Not knowing the user
  • Not knowing the data size of the system
  • Not knowing the longevity of the code
  • Unknown-unknowns (see 2020 for more complete list of examples)

The long-term value of programmers is created by learning as quickly as possible, which is why more bad code needs to be written. Here are some reasons listed by the author:

  1. Build the skill of writing code: If you want to learn how to code, the best way is to practice, with practice it will be easier and avoid problems next time
  2. Reconnect with the joy of creation: writing bad code means focusing on getting results as quickly as possible, which means it’s easy to feel successful and fulfilled
  3. Learn how code and systems fail: Failure is the most valuable learning opportunity, and when something goes wrong, solving the problem in writing code will improve your learning ability
  4. Learn how to debug: When writing bad code, it will give me more opportunities to try debugging
  5. Explore the design space: Because of bad code, there is more room for improvement in subsequent refactor processes. 6: ‍Lowering expectations unleashes more creativity and ideas.


In C/C++ language extern except for the specified declaration, when it is used in conjunction with "C", it will tell the compiler to parse according to the rules of the C language, not the rules of C++, such as extern "C" void fun(int a, int b); This avoids overloading the fun function in C++.


Over the weekend, the plan was disrupted due to temporary matters, and there was no time to release it on time, so I had to fill in the hole today. It seems that we still need to prepare in advance in the future, so as to avoid things like last weekend and resist unknown risks.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store



A programmer. Share knowledge of programming, operating system, Linux kernel, and reading, thinking etc. Let us maintain a beginner mend and grow together!