Daily programming challenges

I have recently discovered leetcode and their daily programming challenges. I have therefore set a passive goal for myself to try and solve these problems on a semi-regular basis (at least 4 per week), as a measure to keep in touch with programming. If and when I solve a problem, I will briefly outline my solution here, and post the relevant code. I am not promising that my solutions are optimized.

If on any given day I am unable to solve the day’s coding challenge within a reasonable time, I will instead work through this curated list of problems.

Leetcode daily:

[———- Hiatus for the rest of the month ———-]
Problem 0368 (Feb 09 2024) [1d dp]
Problem 0279 (Feb 08 2024) [1d dp + Number theory (pretty genius)]
Problem 0451 (Feb 07 2024) [Arrays and Hashing]
Problem 0049 (Feb 06 2024) [Arrays and Hashing]
Problem 1143 (Feb 05 2024) [Arrays and Hashing]
Problem 0076 (Feb 04 2024) [Sliding window]
Problem 1043 (Feb 03 2024) [1-d dynamic programming]
Problem 1291 (Feb 02 2024) [Math + Arrays]
Problem 2966 (Feb 01 2024) [Arrays]
Problem 0739 (Jan 31 2024) [Monotonic stack]
Problem 0150 (Jan 30 2024) [Arrays]
Problem 0629 (Jan 27 2024) [2-d dynamic programming]
Problem 0576 (Jan 26 2024) [3-d dynamic programming]
Problem 1143 (Jan 25 2024) [2-d dynamic programming]
Problem 1457 (Jan 24 2024) [Binary tree dfs]
Problem 1239 (Jan 23 2024) [Backtracking]
Problem 0645 (Jan 22 2024) [Arrays and hashing]
Problem 0198 (Jan 21 2024) [1-d dynamic programming]
Problem 0907 (Jan 20 2024) [1-d dynamic programming + stack] (Notes: Correct solution (with only dp), but TLE)
Problem 0931 (Jan 19 2024) [2-d dynamic programming]
Problem 0070 (Jan 18 2024) [Math + DP + more math]
Problem 1207 (Jan 17 2024) [Arrays and hashing]
Problem 0380 (Jan 16 2024) [Arrays and hashing]
Problem 2225 (Jan 15 2024) [Arrays and hashing]
Problem 1657 (Jan 14 2024) [Arrays and hashing]
Problem 1347 (Jan 13 2024) [Arrays and hashing]
Problem 1704 (Jan 12 2024) [Arrays]
Problem 1026 (Jan 11 2024) [Brute force on binary tree]
Problem 2385 (Jan 10 2024) [Binary tree + Graph search]
Problem 0872 (Jan 09 2024) [Binary tree DFS]
Problem 0938 (Jan 08 2024) [Binary (search) tree DFS]
Problem 0446 (Jan 07 2024) [multi-d dynamic programming]
Problem 1235 (Jan 06 2024) [1-d dynamic programming + binary search]
Problem 0300 (Jan 05 2024) [1-d dynamic programming]
Problem 2870 (Jan 04 2024) [Math + hashing]
Problem 2125 (Jan 03 2024) [Math + arrays]
Problem 2610 (Jan 02 2024) [Arrays and hashing]
Problem 0455 (Jan 01 2024) [Arrays and hashing]
Problem 1624 (Dec 31 2023) [Arrays and hashing]
Problem 1897 (Dec 30 2023) [Arrays and hashing]
Problem 1335 (Dec 29 2023) [2-d dynamic programming]
Problem 1578 (Dec 27 2023) [Sliding window]
Problem 1758 (Dec 24 2023) [Arrays and hashing]
Problem 1496 (Dec 23 2023) [Arrays and hashing]

Arrays and hashing:

Problem 217
Problem 242