diff --git a/common_ds_algo_problems/matrix_spiral_print.cpp b/common_ds_algo_problems/matrix_spiral_print.cpp index 21ca0de..16029a4 100644 --- a/common_ds_algo_problems/matrix_spiral_print.cpp +++ b/common_ds_algo_problems/matrix_spiral_print.cpp @@ -14,7 +14,7 @@ void spiral_print_matrix( int ** matrix, int m, int n) { int a = 0, b = n-1, c = m-1, d = 0; - while( a < c && d < b) { + while( a <= c && d <= b) { for(int i = d; i <= b; ++i ) { std::cout << matrix[a][i] << " "; }