20260331

#include <vector>

class Solution {
public:
    std::vector<int> countBits(int n) {
        std::vector<int> counts(n + 1, 0);
        for (int i = 0; i < n + 1; ++i) {
            int prefix_count = counts[i / 2];
            int last_digit = i % 2;
            counts[i] = prefix_count + last_digit;
        }

        return counts;
    }
};

20260330

20260329

20260328

20260327

20260326

20260325

I haven’t felt any motivation since my wife went on a trip to Japan (causal relationship unconfirmed).

A smart watch (Coros) should be arriving tomorrow. Looking forward to using it daily.

20260324

20260323

I ate too much…

20260322

20260321

20260320

I ate too much today… help!

20260319

20260318

20260317

20260316

20260315

20260314

20260313

20260312

20260311

20260310

When you compile TypeScript, the output is plain JavaScript.

20260309

20260308

Negative feelings motivate me to do more LeetCode.

20260307

20260306

20260305

#include <cstdint>
#include <string>
#include <vector>

class Solution {
public:
    bool wordBreak(const std::string& s, const std::vector<std::string>& wordDict) {
        std::vector<uint8_t> possible(s.size() + 1);
        possible[0] = 1;
        for (size_t i = 0; i < s.size(); ++i) {
            for (const auto& word : wordDict) {
                if (i + word.size() > s.size()) { continue; }
                possible[i + word.size()] |= possible[i] && !s.compare(i, word.size(), word);
            }
        }

        return possible[s.size()];
    }
};

20260304

20260303

20260302

20260301


TODO:


index 202602 202604