solve palindrome-partitioning single-number-ii triangle valid-number