题目: Given two sorted integer arrays A and B, merge B into A as one sorted array. Note: You may assume that A has enough space to hold additional elements from B. The number of elements initialized in A and B are m and n respectively. 题意要把两个有序的数组合并到他们
先看看这个题目:某整形数组中除了两个单身整数外, 其余的整数都是成对出现的, 利用C代码求出这两个单身整数. 要求: 时间复杂度o(n), 空间复杂度o(1). 我们先用最傻瓜的方式来做吧: #include <iostream> using namespace std; // 时间复杂度为o(n^2), 空间复杂度为o(1), 不符合要求 void findSoleNumbers(int a[], int n, int &e1, int &e2) { int i = 0; i