Puzzle Solution

2 posts

Solution for Hackerrank Problem: Basic Cryptanalysis

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.


Solution 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.