LintCode(easy)合并排序数组II

来源:互联网 发布:绿茶和咖啡 知乎 编辑:程序博客网 时间:2024/05/05 09:19
class Solution {public:    /**     * @param A: sorted integer array A which has m elements,      *           but size of A is m+n     * @param B: sorted integer array B which has n elements     * @return: void     */    void mergeSortedArray(int A[], int m, int B[], int n) {        // write your code here       int *p=&A[0],q=m;        for(int i=0;i<n;i++){           A[q]=B[i];           ++q;        }        sort(p,p+m+n);    }};
0 0
原创粉丝点击