Update appNew update is available. Click here to update.
About
Indian Institute of Information Technology (IIIT) Kottayam 2025
My Stats
EXP gained
yellow-spark
1686
Level
5 (Champion)
Community stats
Discussions
1
Upvotes
0
Know more
59
Total problems solved
46
Easy
13
Moderate
0
Hard
0
Ninja
Jan Jan Feb Feb Mar Mar Apr Apr May May Jun Jun Jul Jul Aug Aug Sep Sep Oct Oct Nov Nov Dec Dec

Current streak:

0 days

Longest streak:

3 days

Less

More

Discussions
BEST solution in c++
Interview problems
#include <bits/stdc++.h> 
 vector<int> reverse(vector<int>v){
    int s=0;
    int e=v.size()-1;
    while(s<e){
        swap(v[s++],v[e--]);
    }
        return v;
 }
vector<int> findArraySum(vector<int>&a, int n, vector<int>&b, int m) { 
	vector<int> ans;
    int i=n-1;
    int j=m-1;
    int carry=0;
    while(i>=0 && j>=0){
        int val1=a[i];
        int val2=b[j];
        int sum=val1+val2+carry;
         carry=sum/10;
         sum=sum%10;
        ans.push_back(sum);
        i--;
        j--;
    }
    while(i>=0 ){
        int  sum=a[i]+carry;
        carry=sum/10;
         sum=sum%10;
        ans.push_back(sum);
          i--;
    }
     while(j>=0 ){
        int  sum=b[j]+carry;
          carry=sum/10;
         sum=sum%10;
        ans.push_back(sum);
           j--;
     }
     while(carry!=0 ){
        int sum=carry;
          carry=sum/10;
         sum=sum%10;
        ans.push_back(sum);
     }
    return reverse(ans);
    
}
profile
ARVIND KUMAR
Published On 13-Dec-2022
106 views
0 replies
0 upvotes