摘要:
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 (size that is greater or equal to m + n) to hold additional elements from B. The number of elements initialized in A and B are m and n respectively.class Solution {public: void ... 阅读全文
摘要:
Given an array of integers, every element appearsthreetimes except for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?no extra memory solution:class Solution {public: int singleNumber(int A[], int n) { ... 阅读全文
摘要:
Given an array of integers, every element appearstwiceexcept for one. Find that single one.Note:Your algorithm should have a linear runtime complexity. Could you implement it without using extra memory?class Solution {public: int singleNumber(int A[], int n) { int sinNum; for(int i ... 阅读全文