Month: March 2022

  • Isolate the rightmost (least-significant) bit

    Fast & elegant: Tests Output Brute force Output for the new version Practice 231. Power of Two 191. Number of 1 Bits Related concepts Two’s complement

  • Generate files with random bytes

    The following command grabs 20 Mb of random bytes from /dev/urandom and saves it to rnd.bin: Generate a bunch of files:

  • Kadane’s algorithm

    I just learned about this algorithm, which is considered a dynamic programming approach. However, depending on the implementation, it might not resemble dynamic programming at all. Check out the implementation presented on Wikipedia: That does not look like dynamic programming to me. Now let’s look at the following implementation: Can you see it now? I’m…