796. Rotate String

class Solution:
def rotateString(self, s: str, goal: str) -> bool:
return len(goal) == len(s) and goal in s * 2
Search for a command to run...

class Solution:
def rotateString(self, s: str, goal: str) -> bool:
return len(goal) == len(s) and goal in s * 2
No comments yet. Be the first to comment.
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def balanceBST(self, root: TreeNode) -...

class Solution: def minimumCost(self, nums: List[int]) -> int: return nums.pop(0) + sum(sorted(nums)[:2])

class Solution: def minimumPairRemoval(self, nums: List[int]) -> int: def checkSorted(arr): return arr == sorted(arr) def findAndMerge(arr): minSum = float("inf") trackIndex = -1 ...

class Solution: def minPairSum(self, nums: List[int]) -> int: ''' Sort it out Scan and track max sum ''' nums.sort() l = len(nums) maxSum = 0 for i in range(l//2): ...

Hey folks! Today I encounted a problem which I tried solving 2 years back (2023) Question Link → 1498. Number of Subsequences That Satisfy the Given Sum Condition So, looking at my 2 year old attempt, I wanted to challenge myself to solve it this ti...
