Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit 83572fe

Browse files
author
JainMaster
authoredOct 20, 2020
Add files via upload
1 parent 31e2104 commit 83572fe

File tree

55 files changed

+4871
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+4871
-0
lines changed
 

‎10.Strings/Check Palindrome.ipynb

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Check Palindrome\n",
8+
"Given a String s, check it its palindrome. Return true if string is palindrome, else return false.<br>\n",
9+
"Palindrome strings are those, where string s and its reverse is exactly same.<br>\n",
10+
"<br>\n",
11+
"Input Format :<br>\n",
12+
" String S<br>\n",
13+
" <br>\n",
14+
"Output Format :<br>\n",
15+
"\"true\" if S is palindrome, else \"false\"<br>\n",
16+
"<br>\n",
17+
"Constraints :<br>\n",
18+
"0 <= |S| <= 10^7<br>\n",
19+
"where |S| represents the length of string, S.<br>\n",
20+
"<br>\n",
21+
"Sample Input 1 :<br>\n",
22+
"abcdcba<br>\n",
23+
"Sample Output 1 :<br>\n",
24+
"true <br>\n",
25+
"Sample Input 1 :<br>\n",
26+
"abcd<br>\n",
27+
"Sample Output 1 :<br>\n",
28+
"false"
29+
]
30+
},
31+
{
32+
"cell_type": "code",
33+
"execution_count": null,
34+
"metadata": {},
35+
"outputs": [],
36+
"source": [
37+
"str=input()\n",
38+
"if str==str[::-1]:\n",
39+
" print(\"true\")\n",
40+
"else:\n",
41+
" print(\"false\")"
42+
]
43+
}
44+
],
45+
"metadata": {
46+
"kernelspec": {
47+
"display_name": "Python 3",
48+
"language": "python",
49+
"name": "python3"
50+
},
51+
"language_info": {
52+
"codemirror_mode": {
53+
"name": "ipython",
54+
"version": 3
55+
},
56+
"file_extension": ".py",
57+
"mimetype": "text/x-python",
58+
"name": "python",
59+
"nbconvert_exporter": "python",
60+
"pygments_lexer": "ipython3",
61+
"version": "3.8.6"
62+
}
63+
},
64+
"nbformat": 4,
65+
"nbformat_minor": 4
66+
}

‎10.Strings/Check Permutation.ipynb

Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
{
2+
"cells": [
3+
{
4+
"cell_type": "markdown",
5+
"metadata": {},
6+
"source": [
7+
"# Check Permutation\n",
8+
"Given two strings, S and T, check if they are permutations of each other. Return true or false.<br>\n",
9+
"Permutation means - length of both the strings should same and should contain same set of characters. Order of characters doesn't matter.<br>\n",
10+
"Note : Input strings contain only lowercase english alphabets.<br>\n",
11+
"<br>\n",
12+
"<br>\n",
13+
"Input format :<br>\n",
14+
"Line 1 : String 1<br>\n",
15+
"Line 2 : String 2<br>\n",
16+
"<br>\n",
17+
"Output format :<br>\n",
18+
"'true' or 'false'<br>\n",
19+
"<br>\n",
20+
"Constraints :<br>\n",
21+
"0 <= |S| <= 10^7<br>\n",
22+
"0 <= |T| <= 10^7<br>\n",
23+
"where |S| represents the length of string, S.<br>\n",
24+
"<br>\n",
25+
"Sample Input 1 :<br>\n",
26+
"abcde<br>\n",
27+
"baedc<br>\n",
28+
"Sample Output 1 :<br>\n",
29+
"true<br>\n",
30+
"Sample Input 2 :<br>\n",
31+
"abc<br>\n",
32+
"cbd<br>\n",
33+
"Sample Output 2 :<br>\n",
34+
"false"
35+
]
36+
},
37+
{
38+
"cell_type": "code",
39+
"execution_count": null,
40+
"metadata": {},
41+
"outputs": [],
42+
"source": [
43+
"s=input()\n",
44+
"d=input()\n",
45+
"if sorted(d)==sorted(s):\n",
46+
" print(\"true\")\n",
47+
"else:\n",
48+
" print(\"false\")"
49+
]
50+
}
51+
],
52+
"metadata": {
53+
"kernelspec": {
54+
"display_name": "Python 3",
55+
"language": "python",
56+
"name": "python3"
57+
},
58+
"language_info": {
59+
"codemirror_mode": {
60+
"name": "ipython",
61+
"version": 3
62+
},
63+
"file_extension": ".py",
64+
"mimetype": "text/x-python",
65+
"name": "python",
66+
"nbconvert_exporter": "python",
67+
"pygments_lexer": "ipython3",
68+
"version": "3.8.6"
69+
}
70+
},
71+
"nbformat": 4,
72+
"nbformat_minor": 4
73+
}

0 commit comments

Comments
 (0)
Please sign in to comment.