Birthday Cake Candles Hackerrank Easy Difficulty problem, authored by shashank21j. The max score is 10 Logic Get the number of candles(array size) Declare the array to store candles Sort array in reverse Assign tallest candle to T for comparison Set initial count to 1 for tallest candle Check all candles for match If match found increment counter If match not found …
Read moreSherlock and Squares Code #include <bits/stdc++.h> using namespace std; int main() { int t,i; cin>>t; // input no of testcases for(i=0;i<t;i++) { int a,b,y,total=0; float x; cin>>a>>b; // input starting and ending poi…
Read moreAppend and Delete Code #include <bits/stdc++.h #include <string> using namespace std; int main() { string s,t; int k,i,x,y,z; cin>>s>>t>>k; // taking input x=s.size(); // calculate the size of first string y=t.size(); //calculate the size o…
Read moreEqualize the Array Code #include<bits/stdc++.h> using namespace std; int main() { int n,i,j,count=1,max=0; cin>>n; // input size of the array int a[n]; for(i=0;i<n;i++) // input array { cin>>a[i]; } for…
Read moreTaum & B'day Code #include<bits/stdc++.h> using namespace std; int main() { int t,i; cin>>t; // input no of test cases for(i=0;i<t;i++) { long int b,w,bc,wc,z,total; cin>>b>>w>>bc>>wc>>z; // taking input requirements if((bc+z)<wc) // if cost of purchasing a black g…
Read moreACM ICPC Team Code: #include<bits/stdc++.h> using namespace std; int main() { int n,i,m,j,k,max=0,count=0,ways=0; cin>>n>>m; // taking input number of attendee and topics string a[n]; for(i=0;i<n;i++) // taking input binary string { …
Read moreRepeated String Code #include<bits/stdc++.h> #include<string> using namespace std; int main() { long long int n,i,x,y,c=0; string s; cin>>s; // input string cin>>n; // input size or number of character for(i=0;i<s.size();i++) …
Read moreA very big sum Code #include <bits/stdc++.h> using namespace std; int main() { int n; //array size cin>>n; long long int a[n]; //array for(int i=0;i<n;i++){ //array elements cin>>a[i]; } long long sum=0; //…
Read moreCompare the triplets Code #include <bits/stdc++.h> using namespace std; int main() { int a[3]; //1st array int b[3]; //2nd array // the array size will be fixed that is 3 as given in the problem int x=0; //to store score of 1st int y=0; //to store score of 2nd …
Read moreDiagonal sum Code #include <bits/stdc++.h> using namespace std; int main() { int n; //matrix size cin>>n; int a[n][n]; //the matrix for(int i=0;i<n;i++){ //rows for(int j=0;j<n;j++){ //columns cin>>a[i][j]; } } …
Read morePlus minus Code #include <bits/stdc++.h> using namespace std; int main() { int n; //array size cin>>n; int a[n]; //array double cp=0; //to count number of positive elements double cn=0; //to count number of negative elements double cz=0; …
Read moreSimple array sum Code #include<bits/stdc++.h> using namespace std; int main(){ int n; //array size cin>>n; int a[n]; //array elements int sum=0; //to store sum for(int i=0;i<n;i++){ //reading array elements cin>>a[i]; } for(int i=0;…
Read moreSolve me first Code #include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> using namespace std; int solveMeFirst(int a, int b) { // Hint: Type return a+b; below: return a+b; } int main() { int num1, num2; int sum; cin>>num1>>num2; sum = solveMeFirst(num1,num2); cout<<…
Read moreStaircase Code #include<bits/stdc++.h> using namespace std; //to print the spaces void space(int x) { while(x--) { cout<<" "; } } //to print the stars void star(int y) { while(y--) { cout<<"#"; } } //main function int main() { int n; //Taking the…
Read moreFind Digits Code #include<bits/stdc++.h> using namespace std; int main() { int t,i; cin>>t; // input test cases for(i=0;i<t;i++) { int n,x,y,j,count=0; cin>>n; //input number is taken x=n; …
Read moreJumping on the Clouds Revisited Code #include <bits/stdc++.h> using namespace std; int main() { int n,k,i,e=100; cin>>n>>k; // taking input size of array and jump size int c[n]; for(i=0;i<n;i++) { cin>>c[i]; // input array } if(k>=n) // …
Read moreSequence Equation Code #include<bits/stdc++.h> using namespace std; int main() { int n,x,y,i; cin>>n; //Size of array int a[n]; for(i=0;i<n;i++) { cin>>a[i]; // input array } for(x=1;x<=n;x++) { …
Read moreLeetCode v/s Hackerrank v/s CodeChef You are looking for a perfect platform to start your coding journey. A platform that will help you to practice from basic to advance and finally benefit you to land a fine job. Having a wrong start can make things messy and frustrating. Don't worry I will solve your problem today. With all the research on d…
Read more
tcs
Copyright © 2021 Coding Demons All Rights Reseved
Social Plugin