20260131
rest day
- LeetCode
- 1929. Concatenation of Array (code review)
- 1480. Running Sum of 1d Array (code review)
20260130
- full-time job
- LeetCode
- 268. Missing Number (interview)
- 322. Coin Change (code review)
- 1 hour walk with my wife, arm curl, push ups
20260129
- full-time job
- LeetCode
- 56. Merge Intervals
- 46. Permutations (code review)
- 981. Time Based Key-Value Store
- vehicle registration renewal
20260128
- full-time job (catching up with the speed slowly…)
- I’m proud of me, processing that amount of information in one
day
- LeetCode
- 102. Binary Tree Level Order Traversal (code review)
20260123-20260127
infected with singles, severe headache, severe nausea, fever,
sickness
I thought i would die because I could not eat/drink anything for
almost three days (I vomitted instantly when I tried to ingest
something)
20260122
git rebase --onto main leetcode-236-lowest-common-ancestor-of-a-binary-tree
- 20 minutes walk
- full-time job
- LeetCode
- 981. Time Based Key-Value Store
20260121
pain, fatigue
- took my wife to the test center
- full-time job
- LeetCode
- 1. Two Sum (code review)
- 141. Linked List Cycle (code review)
- 236. Lowest Common Ancestor of a Binary Tree
20260120
fatigue (?)
- full-time job (review, MTG coordination)
- 1 hour walk, arm curl, 30 minutes run
- LeetCode
- 111. Minimum Depth of Binary Tree
20260119
- 25 minutes walk, 50 minutes walk, arm curl, push ups
- code review (full-time job)
- LeetCode
- 104. Maximum Depth of Binary Tree (code review + did it myself)
std::stack<std::pair<const TreeNode*, int>> node_and_depths;
struct
- 56. Merge Intervals
- picture drawing
20260118
- returned a car to my parents
- called a car insurance agent
- lost my wallet and requested card replacements (and some effort to
find the lost wallet)
- LeetCode
- 127. Word Ladder
- 56. Merge Intervals
- 1 hour run
20260117
- 2 hours nap
- 25 minutes walk, 30 minutes walk, 1 hour walk
- LeetCode
- 1929. Concatenation of Array (code review)
- 323. Number of Connected Components in an Undirected Graph (code
review)
- 46. Permutations
- considered suggested approaches
- flag array
prefix_and_remaining
20260116
I will turn off the alarm for tomorrow…
- brought my car to home
- full-time job
- LeetCode
- 695. Max Are of Islands (code review)
- push ups, 1 hour jog
20260115
- full-time job
- LeetCode
- 39. Combination Sum (code review)
- 200. Number of Islands (code review)
- 20 minutes walk, push ups, arm curl, 20 minutes jog
20260114
- full-time job
- LeetCode
- 46. Permutations
- 200 . Number of Islands (code review)
- social events
- Chichen Manchurian was good
- 30 minutes walk, 35 minutes run
20260113
- 40 minutes walk, push ups, 30 minutes run
- full-time job
- LeetCode 39. Combination Sum
- LeetCode 46. Permutations
- Classic problem but it is hard to reason time/space complexity
- LeetCode 560. Subarray Sum Equals K (code review)
- TIL: one way hash map solution
- scheduled appointments
20260112
grep -E '^- \[.*\]\(https://github.com/.*/pull/[0-9]+\)' leetcode.md | wc -l
- LeetCode 929. Unique Email Addresses (code review)
std::string::substr, std::string::erase,
std::set::emplace
- LeetCode 112. Path Sum (code review)
- full-time job
- 30 minutes walk
- LeetCode 98. Validate Binary Search Tree (code review)
- The Technological Republic
- rudder, supersede, opaque, prod, pointy, maturation, quintessential,
plausible
- 40 minutes walk + English conversation with ChatGPT
- LeetCode 39. Combination Sum
- LeetCode 387. First Unique Character in a String (code review)
20260111
I was thinking about just chilling today, but I ended up doing many
household chores and studying hard.
- 30 minutes walk
- LeetCode 349. Intersection of Two Arrays (code review)
- pruning elements to reduce the number of loops
- LeetCode 108. Convert Sorted Array to Binary Search Tree (code
review)
- LeetCode 33. Search in Rotated Sorted Array
- 40 minutes run
20260110
- LeetCode 49. Group Anagrams
- code review (TIL:
std::move)
- LeetCode 994. Rotting Oranges
- 40 minutes walk + English conversation with ChatGPT
- LeetCode Weekly Contest 484
- push ups, 40 minutes walk
20260109
- full-time job
- LeetCode 617. Merge Two Binary Trees
- code review (newline at the end of file, the scope of helper
function, Command-query separation)
- LeetCode 1. Two Sum
- code review (big O notation)
- Hinodeya Ramen and Dr. Ink w/ my wife
- LeetCode 200. Number of Islands
- LeetCode 207. Course Schedule
- LeetCode 133. Clone Graph
- I was surprised I could reproduce solutions for 207 and 133. It is
good.
- 30 minutes walk
- LeetCode 200. Number of Islands
- 30 minutes run
20260108
- full-time job
- LeetCode 373. Find K Pairs with Smallest Sum
- tried myself
- code review
- There are two approaches
- starting from (i, 0), check (index1, index2 + 1)
- starting from (0, 0), check (index1 + 1) and (index1, index2 +
1)
- 30 minutes walk
- 30 minutes walk + English conversation with ChatGPT
- LeetCode 98. Validate Binary Search Tree
import heapq
class Solution:
def kSmallestPairs(
self, nums1: list[int], nums2: list[int], k: int
) -> list[list[int]]:
sum_and_pairs: list[tuple[int, tuple[int, int]]] = [
(nums1[0] + nums2[0], (0, 0))
]
checked_pairs: set[tuple[int, int]] = set()
smallest_pairs: list[list[int]] = []
while sum_and_pairs and len(smallest_pairs) < k:
index1, index2 = heapq.heappop(sum_and_pairs)[1]
if (index1, index2) in checked_pairs:
continue
smallest_pairs.append([nums1[index1], nums2[index2]])
checked_pairs.add((index1, index2))
if index1 + 1 < len(nums1):
heapq.heappush(
sum_and_pairs,
(nums1[index1 + 1] + nums2[index2], (index1 + 1, index2)),
)
if index2 + 1 < len(nums2):
heapq.heappush(
sum_and_pairs,
(nums1[index1] + nums2[index2 + 1], (index1, index2 + 1)),
)
return smallest_pairs
import heapq
class Solution:
def kSmallestPairs(
self, nums1: list[int], nums2: list[int], k: int
) -> list[list[int]]:
sum_and_pairs = []
for i in range(len(nums1)):
heapq.heappush(sum_and_pairs, (nums1[i] + nums2[0], (i, 0)))
smallest_pairs = []
while sum_and_pairs and len(smallest_pairs) < k:
index1, index2 = heapq.heappop(sum_and_pairs)[1]
smallest_pairs.append([nums1[index1], nums2[index2]])
if index2 + 1 < len(nums2):
heapq.heappush(
sum_and_pairs,
(nums1[index1] + nums2[index2 + 1], (index1, index2 + 1)),
)
return smallest_pairs
20260107
- full-time job
- reviewed English words I noted yesterday
- engross, induce, condone, innocuous, vagary, sate
- squat, push ups
- The Technological Republic
- supersede, fetter, unfettered, corporeal
- LeetCode 238. Product of Array Except Self
- checked review comments by Noda-san
rbegin(), rend()
std::partial_sum() in numeric
std::multiplies is in functional
- LeetCode 347. Top K Frequent Elements
- tried heap and sort
- code review
- LeetCode 155. Min Stack
- push ups, 20 minutes run
20260106
- LeetCode 322. Coin Change
- left comments on my own PR, discussing the program’s processing
time
- LeetCode 104. Maximum Depth of Binary Tree
- code review (time/space complexity, simpler condition
branching)
- push ups
- full-time job
- Barron’s Essential Words for the TOEFL
- worthwhile, ascertain, designate. brash, engross, precipitate,
oblivious, encompass, inundate, impartial, appallingly, brazen, induce,
teem (be teeming with), potent, apt (appropriate, be apt to),
aggravate
- The Technological Republic
- ascendant, condone, innocuous, vagary, sate
- 50 minutes walk + English conversation with ChatGPT
- LeetCode 238. Product of Array Except Self
- 25 minutes run
20260105
- full-time job
- checked all the updates while I was away
- did some bug fixes
- LeetCode 703. Kth Largest Element in a Stream
- code review (name mismatch between a constructor and functions)
for (auto it : num_to_count) { iterating
std::map -> it.first,
it.second
- 1 hour walk / English conversation with ChatGPT
- LeetCode 322. Coin Change
20260104
- replied to Nishimura-san
- LeetCode 206. Reverse Linked List
- code review (variable names do not reflect their
values/meanings)
- it was unexpectedly hard to write the solution…
- replied to Noda-san’s comment
- LeetCode 207. Course Schedule (Kahn’s algorithm, DFS)
- LeetCode 208. Implement Trie
- sorted out Dependabot PRs (full-time position)
- 30 minutes jog
20260103
- LeetCode 20. Valid Parentheses
- checked review comments
- std::stack.empty() over std::stack.size() == 0
- for historical reasons, when writing if condition, “…curly braces
may be omitted if as a result the entire statement appears on either a
single line”)
- LeetCode 207. Course Schedule
- checked review comments
- received feedback from Noda-san here: https://github.com/huyfififi/coding-challenges/pull/34
- I was forgetting that dict keys can be traversed without
dict.keys()
- C++: array cannot be created with a size that depends on run time
execution
- retried Kahn’s algorithm
- tackled the vector-based approach (replace
std::set
-> std::vector by defining num class constants)
- LeetCode went down :sweat:
- 30 minutes walk, push ups
- leetCode 21. Merge Two Sorted Lists
- “Use values to own data, pointers to traverse linked structures, and
references to alias a specific object.” by ChatGPT
list1 -> address of node, *list1 ->
the node itself
- Every new must have a corresponding delete.
- LeetCode 122. Best Time to Buy and Sell Stock II
- 1 -> 5 is equivalent to 1 -> 3 and 3 -> 5 (greedy)
- complicated DP
#include <algorithm>
#include <vector>
class Solution {
public:
int maxProfit(std::vector<int>& prices) {
int profit = 0;
for (int i = 1; i < prices.size(); ++i) {
profit += std::max(0, prices[i] - prices[i - 1]);
}
return profit;
}
};
20260102
- LeetCode 207. Course Schedule
- LeetCode 20. Valid Parentheses
- code review (dangling else, No newline at end of file, return bool,
map variable name)
- 30 minutes jog
20260101
- LeetCode 1. Two Sum
- double for loops
- std::map
- std::sort, auto [variable1, variable 2]
- std::vector can be passed by value in addition to by reference, but
the most common pattern is const + reference as it can block
modifications + eliminate the need of copying values
- The Technological Republic
- spur, spurn, untangle, disentangle, electorate, unmoored,
abandonment, textile
- Computer Organization and Design
- SPEC (System Performance Evaluation Cooperative)
- LeetCode 207. Course Schedule
- remembering topological sort
- replied to some work-related messages
- push ups, 40 minutes jog
TODO:
- dentist’s appointment (20260217 11:30 am)
index 202512 202602