icon
Personal Website

Weekly Coding • 2025-08-04

This text was automatically translated to English language by LLM tool.

Hello everyone. It’s time for the weekly report.

LeetCode

Last week, I spent 8 hours on LeetCode. I solved six problems:

  • 122 Best Time to Buy and Sell Stock II
    • Medium problem
  • 123. Best Time to Buy and Sell Stock III
    • Hard. I tried to solve it on my own but failed. I had to watch a tutorial video for this problem.
  • 124. Binary Tree Maximum Path Sum
    • Hard. Solved without hints, although the previous problem could be considered a hint in this case: the problems are solved in similar ways.
  • 126. Word Ladder II
    • Hard. Solved without hints
  • 126. Word Ladder
    • 🤯 Why is Word Ladder 2 listed before Word Ladder 1??? I copied the code from the previous task.
  • 128. Longest Consecutive Sequence
    • A strange problem with an artificial constraint: you need to write an O(n) algorithm, so you cannot sort the array. I watched a tutorial video for this task, but it turned out to be outdated: LeetCode authors updated the tests, and the solution from the video now gets “Time Limit Exceeded.”

Linux Optimizations

In one of my previous posts, I wrote about the Linux optimizations I use on my laptop but didn’t provide specific numbers regarding how much benefit some of these optimizations actually provide. Here they are:

  • Btrfs -46% disk
  • ZSWAP -50% disk
  • KSM -2.5% memory

It turns out that Btrfs and ZSWAP compression save almost half of the disk space 🤯 However, KSM only saves a tiny bit of memory: about 2.5% 🤔 At the same time, KSM consumes about 2.9% CPU. As for the impact of Btrfs and ZSWAP on the CPU, I haven’t measured it because I couldn’t find an easy way to do so.