There's one programming puzzle I solved many years ago but I still remember it because of the unusual solution. Problem: You have a text encrypted with a simple monoalphabetic substitution cipher. You don't have the key but you have a dictionary. Every word in a text can be found in this dictionary. Find the original text. It can be solved by dynamically generating regular expressions.
Algorithms
3 postsSolution for Project Euler Problem #700: Eulercoin
Problem: Imagine a sequence 1504170715041707*n mod 4503599627370517
where n
is an integer increasing from 1. Find the subsequence of this sequence where every next element is smaller than the previous one.
All the solutions I've read about include brute force calculations. I found a better one, and I can't stop myself from posting it.
Finding Overlap Among Groups of Date Ranges
Imagine you have two groups of date ranges and you want to determine whether they overlap.
Nah, let's make it harder. Imagine you have two groups of include date ranges and two groups of exclude date ranges. Your task is to determine, whether there's a date that is present in both include groups and not present in exclude groups. How to do that?