Skip to content

Commit b88f8c8

Browse files
committed
eighth pr in hacktober fest
1 parent 2868c31 commit b88f8c8

2 files changed

Lines changed: 44 additions & 1 deletion

File tree

Linked List Imp Coding Question for your Interview/From LeetCode/2-add-two-numbers/2-add-two-numbers.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,8 @@ class Solution {
3030
l2 = l2->next;
3131
}
3232

33-
sum += carry;
33+
sum =sum+carry;
34+
//
3435
carry = sum / 10;
3536
ListNode* node = new ListNode(sum%10);
3637
temp->next = node;

cpp/Codeforces_WordGame.cpp

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
// https://codeforces.com/contest/1722/problem/C
2+
3+
#include <bits/stdc++.h>
4+
#include <map>
5+
#include <iterator>
6+
using namespace std;
7+
8+
int main() {
9+
int t;
10+
cin>>t;
11+
while(t--){
12+
int n;
13+
cin>>n;
14+
map<string,int>mp;
15+
vector<vector<string>>v;
16+
// vector of vector
17+
for(int i=0;i<3;i++){
18+
vector <string> s;
19+
for(int j=0;j<n;j++){
20+
string ss;
21+
cin>>ss;
22+
mp[ss]++;
23+
s.push_back(ss);
24+
25+
}
26+
v.push_back(s);
27+
28+
}
29+
vector<int>v1(3,0);
30+
for(int i=0;i<3;i++){
31+
for(int j=0;j<n;j++){
32+
if(mp[v[i][j]]==1) v1[i]=v1[i]+3;
33+
else if(mp[v[i][j]]==2) v1[i]=v1[i]+1;
34+
}
35+
}
36+
for(int i=0;i<3;i++){
37+
cout<<v1[i]<<" ";
38+
}
39+
cout<<endl;
40+
41+
}
42+
}

0 commit comments

Comments
 (0)