For personal fun in algorithm