TCS
Company
plz tell me a formula for finding squres in m*n grid
Read Solution (Total 5)
-
- for m*n
no of square--- m*n+(m-1)*(n-1)... till either of (m-i) or (n-i) become 1.
no of square +no of rectangle = m*(m+1)*n*(n+1)/4 - 12 years agoHelpfull: Yes(3) No(0)
- formula of m*n grid
no. of sqr=(m-1)(n-1)+(m-2)(n-2)+............till (m-1)or(n-1)comes to 1
no. of reactangle=(1+2+3+4.........m)(1+2+3+4............n) - 12 years agoHelpfull: Yes(1) No(6)
- n(n+1)(2n+3t+1)/6
here t=m-n - 12 years agoHelpfull: Yes(1) No(0)
- formula of m*n grid
no. of sqr=mn+(m-1)(n-1)+(m-2)(n-2)+............till (m-1)or(n-1)comes to 1
no. of reactangle=(1+2+3+4.........m)(1+2+3+4............n) - 12 years agoHelpfull: Yes(0) No(0)
- mn+(m-1)(n-1)+..........1.1
- 12 years agoHelpfull: Yes(0) No(0)
TCS Other Question