two algorithm from cracking the coding interview