Skip to content

Commit 317f9d7

Browse files
Added solution
1 parent 74e0271 commit 317f9d7

File tree

3 files changed

+91
-0
lines changed

3 files changed

+91
-0
lines changed

hello_world.cpp

+79
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
#include<bits/stdc++.h>
2+
using namespace std;
3+
4+
int mod=1e9+7;
5+
#define F(a,b,var) for(int var=a;var<b;var++)
6+
#define FAST_INP ios_base::sync_with_stdio(false);cin.tie(NULL)
7+
#define ll long long
8+
9+
int main()
10+
{
11+
12+
FAST_INP;
13+
ll no_books, no_libraries, no_days;
14+
cin>>no_books>>no_libraries>>no_days;
15+
16+
vector<ll> book_scores(no_books);
17+
18+
for(int i=0; i<no_books; i++) cin>>book_scores[i];
19+
20+
/*
21+
For each libary => map all the books || 5 books || 2 days || 2 books per day
22+
*/
23+
ll vector<vector<ll>> library_mp;
24+
ll vector<vector<ll>> library_books;
25+
for(int i=0; i<no_libraries; i++){
26+
27+
ll lb, sp, ls; //no books, signup and shipping
28+
29+
cin>>lb>>sp>>ls;
30+
vector<ll> curr_lib;
31+
curr_lib.push_back(lb);
32+
curr_lib.push_back(sp);
33+
curr_lib.push_back(ls);
34+
library_mp.push_back(curr_lib);
35+
36+
vector<ll> clib_books(lb);
37+
for(int j = 0; j <lb; j++) cin>>clib_books[i];
38+
library_books.push_back(clib_books);
39+
40+
}
41+
42+
for(int i=0; i< library_mp.size(); i++){
43+
cout<<"Library -"<<i<<"\n";
44+
for(int j=0; j<library_mp[i].size(); j++){
45+
cout<<library_mp[j]<<"\t";
46+
}
47+
cout<<"\n";
48+
for(int j=0; j<library_books[i].size(); j++){
49+
cout<<library_books[j]<<"\t";
50+
}
51+
cout<<"\n";
52+
}
53+
54+
55+
56+
57+
58+
59+
60+
61+
62+
63+
64+
65+
66+
67+
return 0;
68+
69+
}
70+
71+
72+
/*
73+
6 2 7
74+
1 2 3 6 5 4
75+
5 2 2
76+
0 1 2 3 4
77+
4 3 1
78+
0 2 3 5
79+
*/

hello_world.py

Whitespace-only changes.

long_pressed_name.cpp

+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
class Solution {
2+
public:
3+
bool isLongPressedName(string name, string typed) {
4+
int i = 0, m = name.length(), n = typed.length();
5+
for (int j = 0; j < n; ++j)
6+
if (i < m && name[i] == typed[j])
7+
++i;
8+
else if (!j || typed[j] != typed[j - 1])
9+
return false;
10+
return i == m;
11+
}
12+
};

0 commit comments

Comments
 (0)