Algorithmic Solutions for Programming Contest Problems

Given an integer, determine if it is a palindrome. The straightforward apprroach is to treat the input as a string and check if it reads the same forwards and backwards, which can be done in O(n) time where n is the length of the string. A more efficient approach uses polynomial hashing with O(n) time complexity. We'll implement both forward an ...

Posted on Sun, 02 Aug 2026 16:19:16 +0000 by briglia23

Avoiding Negative Hash Codes from Java's String.hashCode() in Sharding Scenarios

When sharding data by a non-integer primary key or a composite key (usually concatenated in to a string), developers often rely on Java's built-in String.hashCode() method to derive a hash value, which is then used for modulo-based sharding. While convenient, this approach can produce negative hash codes, leading to invalid shard numbers. Under ...

Posted on Tue, 19 May 2026 15:09:12 +0000 by brianbehrens