Skip to content

Commit ff49956

Browse files
authored
Merge pull request ashutosh97#62 from nathansilva/master
Added String_Permutation
2 parents d8eefc0 + 1739fc1 commit ff49956

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed

String_Permutation/question.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Check if two strings are permutations of each other.

String_Permutation/solution.cpp

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
#include<iostream>
2+
#include<string.h>
3+
#include<algorithm>
4+
using namespace std;
5+
6+
7+
int main()
8+
{
9+
string a,b;
10+
cout<<"Enter two strings \n";
11+
cin>>a>>b;
12+
sort(a.begin(),a.end());
13+
sort(b.begin(),b.end());
14+
15+
if(a==b)
16+
cout<<"These strings are permutations of each other\n";
17+
else
18+
cout<<"These strings are NOT permutations of each other\n";
19+
20+
21+
return 0;
22+
}
23+
24+
25+

0 commit comments

Comments
 (0)