diff --git "a/leetcode3/\354\230\244\354\235\200\355\230\201/1706. Where Will the Ball Fall Solved" "b/leetcode3/\354\230\244\354\235\200\355\230\201/1706. Where Will the Ball Fall Solved" new file mode 100644 index 00000000..bff697b0 --- /dev/null +++ "b/leetcode3/\354\230\244\354\235\200\355\230\201/1706. Where Will the Ball Fall Solved" @@ -0,0 +1,24 @@ +class Solution: + def fall(self,grid,y,x): + + if grid[y][x]==1: + if x==len(grid[0])-1:return -1 + if grid[y][x+1]==-1:return -1 + if y+1==len(grid): + return x+1 + return self.fall(grid,y+1,x+1) + + else: + if x==0:return -1 + if grid[y][x-1]==1:return -1 + if y+1==len(grid): + return x-1 + return self.fall(grid,y+1,x-1) + + def findBall(self, grid: list[list[int]]) -> list[int]: + ans=[] + for x in range(len(grid[0])): + ans.append(self.fall(grid,0,x)) + + return ans + diff --git "a/leetcode3/\354\230\244\354\235\200\355\230\201/Code Testcase Testcase Test Result Test Result 2452. Words Within Two Edits of Dictionary" "b/leetcode3/\354\230\244\354\235\200\355\230\201/Code Testcase Testcase Test Result Test Result 2452. Words Within Two Edits of Dictionary" new file mode 100644 index 00000000..09e51c1e --- /dev/null +++ "b/leetcode3/\354\230\244\354\235\200\355\230\201/Code Testcase Testcase Test Result Test Result 2452. Words Within Two Edits of Dictionary" @@ -0,0 +1,18 @@ +class Solution: + def is_same(self,a,b): + cnt=0 + for i in range(len(a)): + if a[i]!=b[i]:cnt+=1 + if cnt>2:return False + return True + def twoEditWords(self, queries: list[str], dictionary: list[str]) -> list[str]: + ans=[] + for a in queries: + for b in dictionary: + if self.is_same(a,b): + ans.append(a) + break + return ans + + +