Online Lemoine’s Conjecture Demo in Go

2n + 1 = p + 2q always has a solution in primes p and q (not necessarily distinct) for n > 2. This online demo finds p and q for given odd number greater than 5. The demo is written in Go and compiled to JavaScript using GopherJS.

 read more »

Lemoine’s Conjecture

2n + 1 = p + 2q always has a solution in primes p and q (not necessarily distinct) for n > 2. Write a Go program to find p and q for given odd number greater than 5.

 read more »

Count spread in O(n)

This is not hard but still interesting. A spread of an array of numbers is the difference between its maximum and minimum. Given an array...

 read more »

No crossing!

On the 2D plane there are (n) blue and (n) red points, no three of them are co-linear. Then we can always pair a blue point with a red ...

 read more »

[Golang] Goldbach's conjecture

Goldbach's conjecture - Every even integer greater than 2 can be written as the sum of two primes. Given a positive even integer, write a Go program to find the two primes.

 read more »

[Golang] BK-tree Data Structure Implementation

Go implementation of BK-tree data structure used for approximate string matching in a dictionary. The distance metric here is Levenshtein distance, the minimum number of single-character edits (insertions, deletions or substitutions) required to change one string into the other.

 read more »

[Golang] Levenshtein Distance Recursive Implementation

Recursive implementation of Levenshtein distance algorithm in Go programming language. Levenshtein distance (LD) is a measure of the similarity between two strings, the minimum number of single-character edits (insertions, deletions or substitutions) required to change one string into the other.

 read more »

[Algorithm] Magical Recurrence

In a recent algorithmic coding contest which I didn't do well, the hardest problem killed me. It distinguished me from other superior coders. But it's still an interesting one. The problem is essentially to solve a 0/1 knapsack problem on a tree where each node is associated with an …

 read more »