solution to various cs problems