Hello, I am doing 1643. Kth Smallest Instructions question, When I run my code, it accepts the solution for a particular test case but when I submit the code, same test case does not pass. Please help me.
class Solution:
allpaths =[]
def kthSmallestPath(self, destination: List[int], k: int) -> str:
r,c = destination
self.findPath(r,c,0,0,"","")
return self.allpaths[k-1]
def findPath(self,r,c,i,j,path,char):
path+=char
if i == r:
for k in range(j,c):
path+= "H"
print(path)
self.allpaths.append(path)
return
if j == c:
for k in range(i,r):
path+= "V"
self.allpaths.append(path)
print(path)
return
self.findPath(r,c,i,j+1,path,"H")
self.findPath(r,c,i+1,j,path,"V")and this is the particular test case that is having issue,
[1,1]
1