This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Node: | |
def __init__(self, val, parent = None): | |
self.val = val | |
self.parent = parent | |
self.left = None | |
self.right = None | |
class Tree: | |
def __init__(self, val_list): |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Maze: | |
def __init__(self, matrix, start, finish): | |
self.maze = matrix | |
self.start = start | |
self.finish = finish | |
def UP(self, i, j): | |
try: | |
return (self.maze[i-1][j], (i-1, j)) | |
except: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
s = input() | |
s = s + s | |
x = input() | |
if(x in s): | |
count = 0 | |
for i in range(len(x)): | |
if(x in s[i:i+len(x)]): | |
print(count, "rotation") | |
break | |
else: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x = int(input()) | |
arr = [] | |
k = 1 | |
for i in range(x): | |
for j in range(i+1): | |
arr.append(str(k)) | |
k += 1 | |
print(arr) | |
t = iter(arr) | |
arr2 = [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Indian Mobile Number validation criteria: | |
The Country calling code for india is +91 | |
valid pre-fixes are 0,91,+91 . | |
All mobile phone numbers are 10 digits long (not including a pre-fix). | |
The first digit should contain number between 9,8,7 or 6. | |
Rest of the nine digits can be any number between 0 to 9. | |
''' |