Daniel's Blog

「 Welcome to Daniel Data 」

LeetCode 2435 | Simple Steps: Write a Simple DP and a Space Optimized DP

Leetcode 2435. Paths in Matrix Whose Sum Is Divisible by K Intuition Step1: subproblem. This can be 3D DP: $DP[i][j][k]$ indicate the #(routes) from $[0,0]$ to $[i,j]$ with value k. Then the goa...

Micro project: Votaility Modeling - 1

This is a series called micro project that I am going to share part of my projects. Last year I did my undergraduate paper in high-frequency votaility modeling with 5 minute data collected from US ...

Algo Note: the idea of some sorting algorithms

I will give all examples in ascending order, just change the judgement clause when you need descending order. $O(n^2)$ sorting algorithms Selection Sort The idea is, always select the smallest v...

DS Note: Monotonic Stack


DS Note: Trie / Prefix Tree

LeetCode Problems 208. Implement Trie (Prefix Tree) 211. Design Add and Search Words Data Structure 212. Word Search II In previous problem, you should use DFS instead of BFS, or you will TLE. ...

Some Python Phrase you should never write

Example 1 Never write: 1 [[0] * 5] * 10 this clause you can only use once, [0] * 5, like this. But if you use [[0] * 5] * 10 instead of [[0]*5 for _ in range(10)], that will make your variable ...

How to Uniquely Decide a Tree From its Traversal

Very short conclusion: at least two traversal can uniquely a tree from the traversal, and one must be inorder traversal.

Amazing proof methods on Permutations

The problems come from the book A First Course in Probability by Sheldon Ross. But I am really sorry since I forgot where the solution I saw, maybe another book, Wikipedia, or maybe some other onli...

Why I think the iPhone 17 Offers the Best Value?

Personally, I believe the iPhone 17 is the most worthwhile option in the new series. Released on September 9, 2025, the iPhone 17 brings a significant balance between price and performance, much li...

What I saw at Seattle

At Seattle. Before landing, a warehouse? of Boeing. You know, Boeing is located at Seattle. Airbus A350-941 (reg N505DN) of Delta Airlines (DL). A very cutting-edge model, strongly recommend by ...