Piyush and Magical Park

Could not figure out Two Test Cases 1 and 2

There is already a hint video on this. You can refer that.
See the value of s does not decrease by 1 when column is last column i.e. j = m - 1. Also if park[i][j] equals to ‘#’ you just need to break the loop not making the value of flag false. Also suppose if in first row the value of flag remains true but in second row the value of s become less than k then you have print no.
Refer this and check how the conditional statements must go: