Professional Documents
Culture Documents
AP 1.2_removed___
AP 1.2_removed___
AP 1.2_removed___
Experiment-1.2
Student Name: Manohar Chaudhary UID: 21BCS4422
Branch: CSE Section/Group: 603-B
Semester: 6th Date of Performance: 23/01/2024
Subject Name: AP Lab-2 Subject Code:21CSP-351
2. Objective:
✓ Highlight the importance of string-matching algorithms.
✓ Define the problem of transforming one string into another through left shifts.
3. Code
1.
class Solution:
def rotateString(self, s: str, goal: str) -> bool:
if len(s) != len(goal):
return False
check = s + s
return check.find(goal) != -1
2.
class Solution:
def solve(self, a: str, b: str) -> int:
s = a
m = 1
n = len(b) // len(a)
for i in range(n + 2):
if b in s:
return m
s += a
m += 1
return -1
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
4. OUTPUT
1.
2.
DEPARTMENT OF
COMPUTER SCIENCE & ENGINEERING
5. Learning Outcomes