Blog

Notes about programming

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.

Valid Combinations of Numbers

Various types of string related problems exist. Among them, splitting it to make something valid would be a typical one. For example, a string of numbers is given, “make valid IP addresses” is the example. Very similar problem is “make valid lottery numbers.”

Weird Puzzle Questions - Egg and Celebrity

I’m going to write about two weird algorithm problems. Those seem quite weired at least to me, yet famous as algorithm questions. One is so-called egg dropping, another is finding a celebrity. I see these two problems here and there. From that, I guess those two are famous algorithm questions. But, at least, those two are quite weird. Some call them puzzle. (Yeah, maybe… I was totally puzzled.)

Sqrt - Math Without Operator To Do It

In my last post, Math Without Operator To Do It, I wrote about division an power implementations. There’s one more of this sort worth adding a memo here. It is calculating a square root without language provided operators.