Find the maximum profit if given an array of daily stock prices and allowed to buy and sell twice
It seems the correctness of doing this to the Maximum Subarray Problem
  is more obvious: the 2 maximum subarrays are just finding the max
  first, and then disregard this region, and find the max of the
  remaining 2 sets of data.


That's actually wrong. Let the array be [2, -1, 4, 2, 3]. Your solution would take the whole array as the maximum during the first step (the sum is 11) and remove it, leaving an empty array, so it would return 11. But that's not correct. Two subarray [0, 1) and [2, 5) add up to 12, yielding an optimal solution.

It also implies that your solution to the stock selling problem is also incorrect (a counter example can be constructed in a similar manner).

You can use dynamic programming to solve the problem correctly. There's a constant number of states in each layer, so the extra space complexity is constant (the code is in python, but it should be easy to implement this algorithm in any other language):

def get_two_max(nums):
    """
    Returns the two maximums in the list.
    The list must contain at least 2 elements.
    """
    max1 = max(nums[0], nums[1])
    max2 = min(nums[0], nums[1])
    for num in nums[2:]:
        if num &gt;= max1:
            max2 = max1
            max1 = num
        elif num &gt; max2:
            max2 = num
    return max1, max2


def get_max_two_subarrays(nums):
    """
    Returns the maximum sum of two non-intersecting non-empty subarrays
    """
    if len(nums) &lt; 2:
        # There're no two non-intersecting non-empty subarrays
        return None
    count_non_neg = sum(1 for num in nums if num &gt;= 0)    
    if count_non_neg &lt; 2:
        # There is at most one positive element, so the optimal answer is 
        # to take two largest elements of the array
        return sum(get_two_max(nums))
    # The state has the following meaning:
    # 0 - the first subarray hasn't started
    # 1 - the first subarray has started, but it's not over yet
    # 2 - the first subarray is over
    # 3 - the second subarray has started, but it's not over yet
    # 4 - both subarrays are over
    dp = [0] * 5
    for num in nums:
        new_dp = [0] * len(dp)
        for state in range(len(dp)):
            # Doesn't change the state. Adds the current element if one of
            # the subarrays is not over.
            new_dp[state] = max(new_dp[state], dp[state] + (num if state % 2 else 0))
            if state + 1 &lt; len(dp):
                # Goes to the next state by opening/closing a subarray
                new_dp[state + 1] = max(new_dp[state + 1], new_dp[state])
        dp = new_dp
    # The answer is the value of the state when both subarrays are over
    return dp[-1]


If you have a solution and you're not sure if it's correct or not, you can do the following:


Implement a slow but obviously correct solution (in this case, it would just generate all subarrays, compute their sums and choose the best one).
Generate thousands of small test cases and compare the output of your solution and the naive one. It's quite likely that you'll a test case your code fails if it's actually wrong (that's exactly how I found a counterexample to your algorithm).