From 757d37c950642e3e1801eef5ae0b5f2063d49ef4 Mon Sep 17 00:00:00 2001 From: Akash Singh <60146338+AkashSingh3031@users.noreply.github.com> Date: Fri, 23 Jul 2021 23:10:21 +0530 Subject: [PATCH 1/7] update books --- .../Important_Books_Link.md | 35 ++++++++++++++----- 1 file changed, 26 insertions(+), 9 deletions(-) diff --git a/6]. Important Books and Resources/Important_Books_Link.md b/6]. Important Books and Resources/Important_Books_Link.md index 24c9bfe40..20f581ea1 100644 --- a/6]. Important Books and Resources/Important_Books_Link.md +++ b/6]. Important Books and Resources/Important_Books_Link.md @@ -46,34 +46,51 @@ └── ... ``` -1. `Programming Language` + --- -## `Data Structures` +## 1. `Programming Language` +- `C Language` + - [Let Us C by `Yashwant P. Kanetkar`]() + - [C in Depth by `S. K. Srivastava`]() +- `C++ Language` + - [Let Us C++ by `Yashwant P. Kanetkar`]() + - [C++: The Complete Reference by `Herbert Schildt`]() +- `Python Language` + - [Core Python by `R. Nageswara Rao`]() +- `Java Language` + - [Core Java - Black Book by `R. Nageswara Rao`]() + +## 2. `Data Structures` - [Data Structures and Algorithms by `Narasimha Karumanchi`]() - [Data Structures and Algorithms in Python by `Michael T. Goodrich`]() -## `Algorithms` +## 3. `Algorithms` - [Introduction to Algorithms by `Thomas H. Cormen`]() - [Algorithms by `Robert Sedgewick` and `Kevin Wayne`]() -## `Competitive Programming` +## 4. `Competitive Programming` - [Guide to Competitive Programming by `Antti Laaksonen`]() - [Competitive Programmer’s Handbook by `Antti Laaksonen`]() - -## `Coding Interviews` +## 5. `Coding Interviews` - [Cracking the Coding Interview by `GAYLE LAAKMANN MCDOWELL `]() -## `Low Level Design` +## 6. `Technical Subjects` +- + +## 7. `Aptitude & Reasoning` +- + +## 8. `Low Level Design` - [Object Oriented Design](https://www.oodesign.com/) -- + --- From ff7deeebc71b8b7f83d32b12feeefcb930477167 Mon Sep 17 00:00:00 2001 From: Akash Singh <60146338+AkashSingh3031@users.noreply.github.com> Date: Sat, 24 Jul 2021 00:06:42 +0530 Subject: [PATCH 2/7] update book resources --- .../Important_Books_Link.md | 71 +++++++++++++++---- 1 file changed, 58 insertions(+), 13 deletions(-) diff --git a/6]. Important Books and Resources/Important_Books_Link.md b/6]. Important Books and Resources/Important_Books_Link.md index 20f581ea1..09b54740d 100644 --- a/6]. Important Books and Resources/Important_Books_Link.md +++ b/6]. Important Books and Resources/Important_Books_Link.md @@ -5,9 +5,19 @@ └── 𝑰𝒎𝒑𝒐𝒓𝒕𝒂𝒏𝒕 𝑩𝒐𝒐𝒌𝒔 | ├── Programming Language | | ├── C +| | | ├── Let Us C by Yashwant P. Kanetkar +| | | ├── C in Depth by S. K. Srivastava +| | | └── ... | | ├── C++ +| | | ├── Let Us C++ by Yashwant P. Kanetkar +| | | ├── C++: The Complete Reference by Herbert Schildt +| | | └── ... | | ├── Python +| | | ├── Core Python by R. Nageswara Rao +| | | └── ... | | ├── Java +| | | ├── Core Java - Black Book by R. Nageswara Rao +| | | └── ... | | └── ... | | | ├── Data Structures @@ -58,31 +68,66 @@ --- ## 1. `Programming Language` + - `C Language` - - [Let Us C by `Yashwant P. Kanetkar`]() - - [C in Depth by `S. K. Srivastava`]() + + + + + +

Let Us C


C in Depth

+ - `C++ Language` - - [Let Us C++ by `Yashwant P. Kanetkar`]() - - [C++: The Complete Reference by `Herbert Schildt`]() + + + + + +

Let Us C++


The Complete Reference

+ - `Python Language` - - [Core Python by `R. Nageswara Rao`]() + + + +

Core Python

+ - `Java Language` - - [Core Java - Black Book by `R. Nageswara Rao`]() + + + +

Core Java - Black Book

## 2. `Data Structures` -- [Data Structures and Algorithms by `Narasimha Karumanchi`]() -- [Data Structures and Algorithms in Python by `Michael T. Goodrich`]() + + + + + + + +

Data Structures and Algorithms


Data Structures and Algorithms


Data Structures and Algorithms in Python

## 3. `Algorithms` -- [Introduction to Algorithms by `Thomas H. Cormen`]() -- [Algorithms by `Robert Sedgewick` and `Kevin Wayne`]() + + + + + +

Introduction to Algorithms


Algorithms

## 4. `Competitive Programming` -- [Guide to Competitive Programming by `Antti Laaksonen`]() -- [Competitive Programmer’s Handbook by `Antti Laaksonen`]() + + + + + +

Guide to Competitive Programming


Competitive Programmer’s Handbook

## 5. `Coding Interviews` -- [Cracking the Coding Interview by `GAYLE LAAKMANN MCDOWELL `]() + + + +

Cracking the Coding Interview

## 6. `Technical Subjects` - From 6c0434f982471ae7566f749f615b18a329700fcb Mon Sep 17 00:00:00 2001 From: Akash Singh <60146338+AkashSingh3031@users.noreply.github.com> Date: Sat, 24 Jul 2021 20:04:36 +0530 Subject: [PATCH 3/7] Add Contributors Profile --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 9b69fd926..6d92b401d 100644 --- a/README.md +++ b/README.md @@ -649,6 +649,8 @@ Thanks goes to these **Wonderful People** 👨🏻‍💻:
GouravRusiya30

💻 ✍️
Akashkhandelwal191

💻 ✍️ + +
RahulSurana123

💻 ✍️ From 448373aeebe0809eebb803e3621d6ec6eef87453 Mon Sep 17 00:00:00 2001 From: Akash Singh <60146338+AkashSingh3031@users.noreply.github.com> Date: Sat, 24 Jul 2021 20:05:03 +0530 Subject: [PATCH 4/7] update number --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 6d92b401d..433f1d74c 100644 --- a/README.md +++ b/README.md @@ -560,7 +560,7 @@ This repository contains all the DSA (Data-Structures, Algorithms, 450 DSA by Lo | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | | **[Akash Singh](https://www.linkedin.com/in/akash-singh3031/)** | -## `Awesome Contributors ✨🎉` `37` +## `Awesome Contributors ✨🎉` `38` Thanks goes to these **Wonderful People** 👨🏻‍💻: From c46665e9cff8b54110bd6457374441424d5f8de0 Mon Sep 17 00:00:00 2001 From: Akash Singh <60146338+AkashSingh3031@users.noreply.github.com> Date: Sat, 24 Jul 2021 20:12:53 +0530 Subject: [PATCH 5/7] Add Array Code Monk Code- Monk and Rotation --- .../1] Arrays & Strings/Monk and Rotation.cpp | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/1] Arrays & Strings/Monk and Rotation.cpp diff --git a/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/1] Arrays & Strings/Monk and Rotation.cpp b/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/1] Arrays & Strings/Monk and Rotation.cpp new file mode 100644 index 000000000..7f68a581b --- /dev/null +++ b/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/1] Arrays & Strings/Monk and Rotation.cpp @@ -0,0 +1,25 @@ +#include +using namespace std; + +int main() +{ + int T; + cin>>T; + while(T--) + + { + long long int n,k; + cin>>n>>k; + k=k%n; + long long int a[n]; + for(long long int i=0;i>a[i]; + } + for( int i=0;i Date: Sat, 24 Jul 2021 20:14:48 +0530 Subject: [PATCH 6/7] Code Monk Array - The Unlucky 13 --- .../1] Arrays & Strings/The Unlucky 13.cpp | 86 +++++++++++++++++++ 1 file changed, 86 insertions(+) create mode 100644 3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/1] Arrays & Strings/The Unlucky 13.cpp diff --git a/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/1] Arrays & Strings/The Unlucky 13.cpp b/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/1] Arrays & Strings/The Unlucky 13.cpp new file mode 100644 index 000000000..b9aee11dc --- /dev/null +++ b/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/1] Arrays & Strings/The Unlucky 13.cpp @@ -0,0 +1,86 @@ +#include +using namespace std; +#define int long long +#define endl "\n" +#define fastio() ios::sync_with_stdio(0);cin.tie(0) +#define mod 1000000009 + +void io() +{ + ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0); + #ifndef ONLINE_JUDGE + freopen("/home/kashif/cp/input.txt","r",stdin); + + freopen("/home/kashif/cp/output.txt","w",stdout); + #endif + +} +int i,j,k; +int M[4][4] = {{0,99,-10,2},{1,0,0,0},{0,1,0,0},{0,0,0,10}}; +int p; +void multiply(int a[4][4],int b[4][4]) +{ + + int mul[4][4]={0}; + for(i=0;i<4;i++) + { + for(j=0;j<4;j++) + { + for(k=0;k<4;k++) + { + + p=(a[i][k]*b[k][j]); + mul[i][j]=(mul[i][j]+p); + + } + } + } + + + for(i=0;i<4;i++) + { + for(j=0;j<4;j++) + a[i][j]=mul[i][j]%mod; + } + +} +void power(int a[4][4],int n) +{ + if(n==1 || n==0) + return; + power(a,n/2); + multiply(a,a); + if (n%2 != 0) + multiply(a,M); +} + +int32_t main() +{ + + fastio(); + io(); + int t,n,ans; + cin>>t; + while(t--) + { + + cin>>n; + if(n==0) + printf("%d\n",1); + else if(n==1) + printf("%d\n",10); + else if(n==2) + printf("%d\n",99); + else if(n==3) + printf("%d\n",980); + else + { + int a[4][4]={{0,99,-10,2},{1,0,0,0},{0,1,0,0},{0,0,0,10}}; + power(a,n-3); + p=(a[3][3]*1000); + k=(a[0][0]*20+a[0][1]+100*a[0][3])%mod; + ans=(p-k+mod)%mod; + printf("%lld\n",ans); + } + } +} From abc806d88ff18291669ca4e5d85970c02773055f Mon Sep 17 00:00:00 2001 From: Akash Singh <60146338+AkashSingh3031@users.noreply.github.com> Date: Sat, 24 Jul 2021 20:17:54 +0530 Subject: [PATCH 7/7] Code Monk Checkpoint 1 -Monk Celebrating Checkpoint --- .../Monk Celebrating Checkpoint.cpp | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/6]. Check Point - 1/Monk Celebrating Checkpoint.cpp diff --git a/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/6]. Check Point - 1/Monk Celebrating Checkpoint.cpp b/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/6]. Check Point - 1/Monk Celebrating Checkpoint.cpp new file mode 100644 index 000000000..db6c47591 --- /dev/null +++ b/3]. Competitive Programming/05]. HackerEarth/1]. Practice/5]. Code Monk Series/6]. Check Point - 1/Monk Celebrating Checkpoint.cpp @@ -0,0 +1,129 @@ +#define _CRT_SECURE_NO_WARNINGS +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#define y0 sdkfaslhagaklsldk + +#define y1 aasdfasdfasdf +#define yn askfhwqriuperikldjk +#define j1 assdgsdgasghsf +#define tm sdfjahlfasfh +#define lr asgasgash +#define norm asdfasdgasdgsd +#define have adsgagshdshfhds + +#define eps 1e-7 +#define M_PI 3.141592653589793 +#define bs 1000000007 +#define bsize 337 + +using namespace std; + +const int INF = 1e9; +const int N = 300031; + +int n, ar[N]; +int k, x; +vector > order; +set S; +set::iterator it; +long long ANS; +vector > T; +long long C[N]; + +int main(){ + //freopen("tree.in","r",stdin); + //freopen("tree.out","w",stdout); + // freopen("F:/input.txt", "r", stdin); + // freopen("F:/output.txt", "w", stdout); + ios_base::sync_with_stdio(0); + //cin.tie(0); + + cin >> n >> x >> k; + for (int i = 1; i <= n; i++) + { + cin >> ar[i]; + order.push_back(make_pair(ar[i], i)); + } + + S.insert(0); + S.insert(n+1); + + sort(order.begin(), order.end()); + + reverse(order.begin(), order.end()); + + for (int i = 0; i < order.size(); i++) + { + int ps = order[i].second; + it = S.lower_bound(ps); + int val1 = (*it); + --it; + int val2 = (*it); +// cout << val1 << " " << val2 << endl; + + long long here = (val1 - ps) * 1ll * (ps - val2 ); + //cout << here << "%" << ar[ps] << endl; + ANS += 1ll * here*ar[ps]; + C[ps] = here; + S.insert(ps); + } + //cout << ANS << endl; + + S.clear(); + sort(order.begin(), order.end()); + S.insert(0); + S.insert(n + 1); + + for (int i = 0; i < order.size(); i++) + { + int ps = order[i].second; + it = S.lower_bound(ps); + int val1 = (*it); + --it; + int val2 = (*it); + // cout << val1 << " " << val2 << endl; + + long long here = (val1 - ps) * 1ll * (ps - val2); + //cout << here << "%" << ar[ps] << endl; + ANS -= 1ll * here*ar[ps]; + //T.push_back(make_pair(here, ps)); + C[ps] -= here; + S.insert(ps); + T.push_back(make_pair(C[ps], ps)); + } + + /*for (int i = 1; i <= n; i++) + { + cout << C[i] << " "; + } + cout << endl; + */ + sort(T.begin(), T.end()); + reverse(T.begin(), T.end()); + + for (int i = 0; i < x; i++) + { + if (T[i].first>0) + ANS += T[i].first; + } + cout << ANS << endl; + + cin.get(); cin.get(); + return 0; +}