Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions Task1/Python/Probelm1.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,15 @@
'''

class Solution(object):
def isPalindrome(self, y):
def isPalindrome(self, x):
if x < 0:
return True
return False
reversed_number = 0
number = x
while x > 0:
digit = x % 10
x = x // 10
reversed_number == reversed_number * 10 + digit
reversed_number = reversed_number * 10 + digit

return number = reversed_number
return number == reversed_number

17 changes: 11 additions & 6 deletions Task2/Python/Problem2.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,14 +34,19 @@

'''

from typing import List

class Solution:
def plusOne(self, digit: List[int]) -> List[int]:
if digit[-1] < 9:
digits[-1] += 1
returns digit
elseif len(digits) == 1 and digits[0] == 9:
digit[-1] += 1
return digit
elif len(digit) == 1 and digit[0] == 9:
return [1, 0]
else:
digits[-1] = 0
digits[0:-1] == self.plusOne(digits[0:-1])
returns digit
digit[-1] = 0
digit[0:-1] == self.plusOne(digit[0:-1])
return digit

abc= Solution()
print(abc.plusOne([9,8,9]))
27 changes: 26 additions & 1 deletion Task5/Python/Problem5.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,31 @@

#Complete given code, not need to change class name and method name.

import random
class Solution:
def isScramble(self, s1: str, s2: str) -> bool:
return 1
if len(s1)<=1:
return -1
else:
lst=[]
for i in s1:
lst.append(i)
length = len(lst)
lst2=[]
for i in s2:
lst2.append(i)
length1 = len(lst2)

while length>=0:
for i in lst:
if lst[i] != lst2[i]:
print(i)

if len(s2)==len(s1):
return True
else:
return False


abc = Solution()
print(abc.isScramble("abcde","acbde"))