Consider all the zeros, and check if we can skip 0s, if we can, then we can jump to the last Ids.
Consider all the zeros, and check if we can skip 0s, if we can, then we can jump to the last Ids.
Problem: 2Sum
Problem: Description: Given an array of integers, find two numbers such that they add up to a specific target number.

The function twoSum should return indices of the two numbers such that they add up to the target, where index1 must be less than index2. Please note that your returned answers (both index1 and index2) are not zero-based.

You may assume that each input would have exactly one solution.

Input: numbers={2, 7, 11, 15}, target=9
Output: index1=1, index2=2

Can't pass judge large
Problem: LongestPalindromeString
Problem Description: Given a string S, find the longest palindromic substring in S. You may assume that the maximum length of S is 1000, and there exists one unique longest palindromic substring.

O(n^2) complexity solution , also can be done using dynamic programming
use a map, don't know how to use hash map in C++, but it works
Problem: Merge K Sorted Lists
Problem Description: Merge k sorted linked lists and return it as one sorted list. Analyze and describe its complexity.

Use recursive approach, divide this problem to a set of merge two sorted linked lists problems. If each list has n elements and we have k lists, the complexity should be O( nk(log k ) );