Category Archives: ShortPosts

LeetCode helper (Tampermonkey)

A tiny script that facilitates interactions with the LeetCode website. It adds one button on the top-left to easily copy the problem ID and problem URL. Because copying the ID from the URL bar is a pain in the neck.

Posted in ShortPosts, SoftwareEngineering | Comments Off on LeetCode helper (Tampermonkey)

Merriam-Webster helper (Tampermonkey)

A tiny script that makes merriam-webster.com/ work nicely with Vimium. Features:

Posted in ShortPosts, SoftwareEngineering | Comments Off on Merriam-Webster helper (Tampermonkey)

Segment Tree

Theory Implementation With lazy propagation Practice problems

Posted in Algorithms & Data structures, Posts, ShortPosts, SoftwareEngineering | Comments Off on Segment Tree

Knuth-Morris-Pratt algorithm for substring search

Theory Implementation Practice problems

Posted in Algorithms & Data structures, Posts, ShortPosts, SoftwareEngineering | Comments Off on Knuth-Morris-Pratt algorithm for substring search

Rabin-Karp algorithm for substring search

Theory Implementation Practice problems

Posted in Algorithms & Data structures, Posts, ShortPosts, SoftwareEngineering | Comments Off on Rabin-Karp algorithm for substring search

Boyer-Moore algorithm for substring search

Theory Implementation Practice problems

Posted in Algorithms & Data structures, Posts, ShortPosts, SoftwareEngineering | Comments Off on Boyer-Moore algorithm for substring search

Exclude directories in IntelliJ’s Find in Files

So, I’m working on a small project. Once in a while I open Find in Files to look something up, but I notice that the search is a bit slow even though I only have a few files. I’m aware … Continue reading

Posted in ShortPosts, SoftwareEngineering | Leave a comment

C++: Unordered maps and sets for non-primitive types

Since C++ 11, we can use unordered sets and unordered maps. However, these data structures only seem to work with primitive types and strings. If you need a pair or a vector as the key, you’re out of luck. Fortunately, … Continue reading

Posted in Algorithms & Data structures, Posts, ShortPosts, SoftwareEngineering | Leave a comment

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

Posted in Algorithms & Data structures, Posts, ShortPosts | Leave a comment

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:

Posted in Posts, ShortPosts, SoftwareEngineering | Leave a comment