20260719
- LeetCode
- 231. Power of Two
- 342. Power of Four
- 326. Power of Three
- 26. Remove Duplicates from Sorted Array
- squats, push ups, 2k run, 16000 steps in total
- planed with Chrome extension (overriding GitHub CSS)
- created the color palette with eye-saver mode enabled. I was
surprised when I turned off the eye-saver mode finding out it looks very
different.
20260718
- 反ミーム部門は存在しない
- LeetCode
- 26. Remove Duplicates from Sorted Array (code review)
- squats, 2k run, 10000 steps in total
- diet log in ChatGPT
20260717
- work (hecking hard - so many pull requests)
git push --force-with-lease
- diet log in ChatGPT
- squats, 6k jog, 18000 steps in total
20260716
- started a thread on a diet
- work (hard)
- LeetCode
- 231. Power of Two
- 342. Power of Four
- 326. Power of Three
- I could find the pattern after ChatGPT gave me a subtle hint, but
estimating the specific number
- Invert + add 1
- the most significant bit is the sign bit in the two’s complement
representation.
- squats, push ups, 1 hour walk
class Solution:
def isPowerOfThree(self, n: int) -> bool:
if n <= 0:
return False
return 3 ** 19 % n == 0
20260715
- work (hard)
- sushida
- checked apple/container
container is a tool that you can use to create and run
Linux containers as lightweight virtual machines on your Mac. It’s
written in Swift, and optimized for Apple silicon.
- LeetCode
- 231. Power of Two
- 342. Power of Four
- 326. Power of Three
- squats, push ups, 4k jog
20260714
- LeetCode
- 342. Power of Four
- 231. Power of Two
- work (very hard)
- squats, push ups, 4k jog
class Solution:
def isPowerOfFour(self, n: int) -> bool:
# 4 ≡ 1 (mod 3)
# 4^k ≡ 1^k ≡ 1 (mod 3)
if n <= 0:
return False
if n & (n - 1) != 0:
return False
return n % 3 == 1
20260713
- LeetCode
- 342. Power of Four
- practiced the loop-based solution three times
- practiced the bitmask solution three times
- squats, push ups, 20 minutes indoor jog
- work (Why am I working so hard?)
class Solution:
def isPowerOfFour(self, n: int) -> bool:
# 1 -> 1
# 4 -> 100
# 16 -> 10000
if n <= 0:
return False
if n & (n - 1) != 0:
return False
EVEN_BIT_MASK = 0x55555555
return n & EVEN_BIT_MASK != 0
20260712
- Computer Organization and Design
- work (hard)
- LeetCode
- 342. Power of Four
- I missed to ues
2^10 = 1024 =~ 10 ^ 3
n & (n - 1) == 0
- tomorrow, I’ll explore the math trick approach
- squats, 4k jog
CPU Core
│
Registers (~1 KB, fastest)
│
L1 Cache (~32–64 KB)
│
L2 Cache (~256 KB–2 MB)
│
L3 Cache (~8–64 MB)
│
RAM (GBs)
│
SSD / HDD (TBs)
The number of cache levels in a CPU is a design choice that balances speed, capacity, power, and cost.
class Solution:
def isPowerOfFour(self, n: int) -> bool:
return (
n > 0 # 4 ^ x cannot be negative
and n & (n - 1) == 0 # exactly one bit is set
and n & 0x55555555 == n # 1 bit at even position - 4 ^ x
# and (n & 0x55555555) != 0 # alternative
)
20260711
- work
- update tickets
- code review
- publish changes
- LeetCode
- 70. Climbing Stairs
- recursion, dp, dp with a fixed memory
- 310. Minimum Height Trees
- 7/11 free slurpee
- squats
# I know this solution does not pass the test cases
# This is just for my reference
import collections
class Solution:
def findMinHeightTrees(self, n: int, edges: list[list[int]]) -> list[int]:
node_to_neighbors = collections.defaultdict(list)
for node1, node2 in edges:
node_to_neighbors[node1].append(node2)
node_to_neighbors[node2].append(node1)
def get_height(node: int, parent: int) -> int:
return max(
(
get_height(neighbor, node)
for neighbor in node_to_neighbors[node]
if neighbor != parent
),
default=0
) + 1
min_height = float("inf")
min_roots = []
for node in range(n):
height = get_height(node, None)
if height > min_height:
continue
elif height < min_height:
min_height = height
min_roots = [node]
else: # height == min_height
min_roots.append(node)
return min_roots
20260710
- work
- squats, chest press, lat pull down
- OWASP Top 10:2025
- LeetCode 200. Number of Islands
20250709
- push ups, squats
- work
- I wore a kurta to the office.
20260708
- Darkest Dungeon
- Hunter x Hunter
- rest
20260707
- work (some chores)
- submitted reimbersement requests
20250706
20260621-20260705
index 202606 202608