Blog

Notes about programming

Catalan number

What is Catalan number ? The Catalan number belongs to the domain of combinatorial mathematics. It is a sequence of natural numbers such that: 1, 1, 2, 5, 14, 42, 132, 429, 1430, 4862, 16796, 58786, 208012, 742900, 2674440, 9694845, 35357670, 129644790, 477638700, 1767263190, ... The sequence appears in counting problems. Wikipedia has the details about the sequence: Catalan Number.

Prime Check of a Big Number

“Given an integer n, find whether n is a prime number or not” – This is a typical algorithm question. If the given number is small, repeating a division from 2 to n gives the answer.

HackerRank Code Testing by Clojure

Recently, I decided to give Clojure a try. This post is about testing HackerRank problems on a local env.

Maximal Square and Rectangle

A bunch of algorithm questions take a style of “maximum is a good thing.” Maximal sum, maximal length or maximal size are examples. This memo is about maximal size, precisely, square and rectangle.

Iterator To Flatten It

Let’s revisit the Iterator pattern. “Iterator” is one of design patterns in object-oriented programming (OOP). Needless to say, extremely famous Gang of Four (Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides) are creators. As in the Wikipedia’s Iterator pattern, the iterator pattern is used when traversing container without knowing how the container works. It is OOP’s favorite pattern to “decouple” the iterator from container.