Skip to content

Commit 84fef26

Browse files
cost-of-n-ropes-added
1 parent 781bd14 commit 84fef26

File tree

2 files changed

+74
-5
lines changed

2 files changed

+74
-5
lines changed
+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#include <bits/stdc++.h>
2+
using namespace std;
3+
4+
int minCost(int arr[], int n)
5+
{
6+
priority_queue<int, vector<int>, greater<int> > pq(arr, arr + n);
7+
int res = 0;
8+
9+
while (pq.size() > 1) {
10+
int first = pq.top();
11+
pq.pop();
12+
int second = pq.top();
13+
pq.pop();
14+
res += first + second;
15+
pq.push(first + second);
16+
}
17+
18+
return res;
19+
}
20+
21+
int main()
22+
{
23+
int len[] = { 4, 3, 2, 6 };
24+
int size = sizeof(len) / sizeof(len[0]);
25+
cout << "Minimum Cost for connecting ropes is: " << minCost(len, size);
26+
return 0;
27+
}

Resources/README.md

+47-5
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
# Data Structures and Algorithms
2+
23
- https://medium.freecodecamp.org/i-built-an-app-that-makes-learning-algorithms-and-data-structures-way-more-fun-46fbb8afacaf
34
- http://www.ideserve.co.in/
45
- https://www.udacity.com/course/data-structures-and-algorithms-in-python--ud513
56

6-
77
# Stanford Online Course
8+
89
- http://web.stanford.edu/class/archive/cs/cs161/cs161.1168/
910
- http://online.stanford.edu/courses
1011

1112
# Competitive Programming Sites
13+
1214
- https://www.hackerrank.com/
1315
- https://www.hackerearth.com
1416
- https://codesignal.com/
@@ -17,6 +19,7 @@
1719
- https://www.spoj.com/
1820

1921
# Javascript
22+
2023
- https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide
2124
- https://medium.freecodecamp.com/my-giant-javascript-basics-course-is-now-live-on-youtube-and-its-100-free-9020a21bbc27
2225
- https://medium.freecodecamp.com/a-step-by-step-guide-to-making-pure-css-tooltips-3d5a3e237346
@@ -25,12 +28,14 @@
2528
- https://medium.freecodecamp.com/javascript-arrays-and-objects-are-just-like-books-and-newspapers-6e1cbd8a1746
2629
- https://medium.freecodecamp.org/a-practical-guide-to-fetch-reduce-and-formatting-data-from-an-external-api-283ddd9bfdcb
2730
- http://www.javascriptgrammar.com/?v=bio
28-
- https://javascript.info/
31+
- https://javascript.info/ -https://courses.learncodeonline.in/learn/Complete-Javascript-course
2932

3033
# Javascript Style Guide
34+
3135
- https://codeburst.io/5-javascript-style-guides-including-airbnb-github-google-88cbc6b2b7aa
3236

3337
# Python
38+
3439
- https://docs.python.org/3/index.html
3540
- https://developers.google.com/edu/python/
3641
- https://pythonschool.net/
@@ -43,26 +48,31 @@
4348
- https://www.learnpython.org/
4449

4550
# Web Development
51+
4652
- https://developers.google.com/web/ilt/pwa/
4753
- https://hackernoon.com/the-2019-web-developer-roadmap-ab89ac3c380e
4854
- https://medium.com/@sunilsandhu/the-web-developer-roadmap-for-2019-692cb02d36a4
49-
- https://medium.com/zerotomastery/web-developer-monthly-july-2019-a65ac4c1e223
55+
- https://medium.com/zerotomastery/web-developer-monthly-july-2019-a65ac4c1e223
5056

5157
# GitHub
58+
5259
- https://guides.github.com/introduction/flow/
5360
- https://codeburst.io/git-good-part-a-e0d826286a2a
54-
- https://codeburst.io/git-good-a-practical-introduction-to-git-and-github-in-git-we-trust-f18fa263ec48
61+
- https://codeburst.io/git-good-a-practical-introduction-to-git-and-github-in-git-we-trust-f18fa263ec48
5562
- https://lab.github.com/
5663
- https://learngitbranching.js.org/
5764
- https://www.codecademy.com/learn/learn-git
5865

5966
# Apple
67+
6068
- https://machinelearning.apple.com
6169

6270
# Google Developers
71+
6372
- https://developers.google.com/style/word-list
6473

6574
# Facebook
75+
6676
- https://www.facebook.com/careers/life/preparing-for-your-software-engineering-interview-at-facebook
6777
- https://www.techinasia.com/talk/crack-google-facebooks-software-engineering-interview
6878
- https://www.glassdoor.com/blog/want-to-work-at-facebook-lori-goler/
@@ -71,119 +81,151 @@
7181
- https://medium.freecodecamp.org/software-engineering-interviews-744380f4f2af
7282

7383
# Facebook - Education and Research
84+
7485
- https://research.fb.com/programs/fellowship/
7586
- https://www.facebook.com/careers/program/fellowship/
7687
- https://research.fb.com/category/facebook-ai-research-fair/
7788
- https://research.fb.com/downloads/detectron/
7889

7990
# Spotify
91+
8092
- https://hrblog.spotify.com/2017/02/17/how-to-get-a-job-at-spotify/
8193

8294
# Amazon
95+
8396
- https://campusmantra.blogspot.in/2017/03/amazon-interview-experience.html
8497
- https://medium.freecodecamp.com/why-learning-to-code-alexa-skills-is-the-gateway-to-a-cloud-computing-job-fa13c1c0c853
8598

8699
# Twitter
100+
87101
- https://careers.twitter.com/content/dam/careers-twitter/university/FINAL_RESUME101.pdf
88102

89103
# Microsoft
104+
90105
- https://hackernoon.com/thank-you-microsoft-for-the-amazing-software-engineer-internship-407a49b8f816
91106
- https://cloudsociety.microsoft.com/en/login/
92107

93108
# NVIDIA
109+
94110
- https://developer.nvidia.com/developer-program
95111

96112
# Hackerrank
113+
97114
- http://protext.hackerrank.com/
98115

99116
# Self Driving Car
117+
100118
- https://medium.com/self-driving-cars/term-1-in-depth-on-udacitys-self-driving-car-curriculum-ffcf46af0c08#.fyy29vejz
101119

102120
# Youtube Playlist
121+
103122
- https://www.youtube.com/playlist?list=PLNYkxOF6rcIB1V2i_qfRtDMcY6YZK1lkt
104123

105124
# Redux
125+
106126
- https://egghead.io/courses/getting-started-with-redux
107127
- https://egghead.io/courses/building-react-applications-with-idiomatic-redux
108128

109129
# Angular JS
130+
110131
- https://angular-university.io/course/getting-started-with-angular2
111132

112133
# Firebase
134+
113135
- https://medium.freecodecamp.org/firebase-5-way-too-common-misconceptions-93b843ee1b93
114136

115137
# CSS
138+
116139
- https://medium.freecodecamp.org/reducing-css-bundle-size-70-by-cutting-the-class-names-and-using-scope-isolation-625440de600b
117140
- https://css-tricks.com/
118141
- https://flexboxfroggy.com/
119142
- http://cssgridgarden.com/
120143

121144
# GoLang
145+
122146
- https://hackr.io/tutorials/learn-golang
123147
- https://golang.org/doc/
124148

125149
# Kotlin
150+
126151
- https://android.jlelse.eu/handsome-codes-with-kotlin-6e183db4c7e5
127152

128153
# Setting up your portfolio
154+
129155
- https://medium.freecodecamp.org/an-illustrated-guide-for-setting-up-your-website-using-github-cloudflare-5a7a11ca9465
130156

131157
# Portfolio
158+
132159
- http://debarghyadas.com/
133160
- http://www.briandavidvaughn.com
134161
- Security Princess | http://asirap.net/
135162

136163
# Cloud Computing
164+
137165
- https://medium.freecodecamp.org/why-learning-to-code-alexa-skills-is-the-gateway-to-a-cloud-computing-job-fa13c1c0c853
138166

139167
# Internet of Things
168+
140169
- https://iot-for-all.com/6-things-you-didnt-know-about-gps-efb37e83bd02
141170

142171
# DNS
172+
143173
- https://medium.freecodecamp.com/the-domain-name-system-dns-is-the-backbone-of-the-internet-heres-how-it-all-works-5706d0afa0fa
144174

145175
# Messaging Bots
176+
146177
- https://chatbotsmagazine.com/you-and-your-bot-a-new-kind-of-lifelong-relationship-6a9649feeb71
147178

148179
# Chrome Developer Tools
180+
149181
- https://medium.freecodecamp.org/mastering-chrome-developer-tools-next-level-front-end-development-techniques-3ac0b6fe8a3
150182

151183
# Design
184+
152185
- https://medium.com/@michellechanme/what-i-learned-as-a-design-intern-at-tesla-and-uber-3a357bcb0d51
153186
- https://medium.muz.li/20-portfolio-designs-that-will-impress-any-client-8fb74689ceb2
154187

155188
# System/Software Design
189+
156190
- https://www.careercup.com/page?pid=software-design-interview-questions
157191
- http://blog.gainlo.co/index.php/category/system-design-interview-questions/
158192
- https://www.hiredintech.com/system-design
159193

160194
# Hackathon Ideas and Best Projects
195+
161196
- https://medium.freecodecamp.org/how-we-recreated-amazon-go-in-36-hours-e32a4101d5f0
162197

163198
# Udacity Nannodegree Review
199+
164200
- https://hackernoon.com/a-review-of-udacitys-react-nano-degree-1085273f1a73
165201

166202
# Self Improvement
203+
167204
- https://www.quora.com/How-can-I-improve-myself-in-6-months/answer/Rithik-Singh-2
168205

169206
# Startup Ideas
207+
170208
- https://medium.com/startup-grind/how-to-come-up-with-startup-ideas-that-are-worth-your-time-36cc54b53b5
171209

172210
# Books Reading
211+
173212
- https://medium.com/swlh/18-books-everyone-will-be-reading-in-2018-82e017d166f
174213

175214
# Blog Reading
215+
176216
- https://medium.com/@DaveSchools/the-60-most-recommended-medium-stories-of-all-time-80a0febc5ac6
177217

178218
# Events and Conferences
219+
179220
- https://aws.amazon.com/summits/
180221
- https://www.ampproject.org/amp-conf/
181222

182223
# Google I/O
183-
- https://mustafaali.net/2018/03/25/pro-tips-for-attending-google-io/
184224

225+
- https://mustafaali.net/2018/03/25/pro-tips-for-attending-google-io/
185226

186227
# Extras
228+
187229
- https://www.awseducate.com/student
188230
- https://developers.facebook.com/products/camera-effects/frame-studio/
189231
- https://googleyasheck.com/

0 commit comments

Comments
 (0)