Skip to content

Commit

Permalink
Merge pull request shivaylamba#569 from Srijan7777/master
Browse files Browse the repository at this point in the history
Added Algorithms
  • Loading branch information
shivaylamba authored Oct 3, 2020
2 parents 0b6beb2 + 65eaf95 commit 32d21fd
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Languages/C++/Max. substring in string.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include <bits/stdc++.h>
using namespace std;

string MaxString(string str)
{
// loop to find the max leicographic
// substring in the substring array
string mx = "";
for (int i = 0; i < str.length(); ++i)
mx = max(mx, str.substr(i));

return mx;
}

int main()
{
string str = "ababaa";
cout << MaxString(str);
return 0;
}
18 changes: 18 additions & 0 deletions Languages/C++/half-star pattern.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#include <iostream>
using namespace std;
int main()
{
int i, j, n;
cout << "Enter number of rows: ";
cin >> n;
for(i = 1; i <= n; i++)
{
for(j = 1; j <= i; j++)
{
cout << "* ";
}
//Ending line after each row
cout << "\n";
}
return 0;
}

0 comments on commit 32d21fd

Please sign in to comment.