My own solution for TopCoder Algorithm SRM problems