From 120549a26a8335c8b2a052109a76ee083dbf8c45 Mon Sep 17 00:00:00 2001 From: Aayush kumar shrivastav <118097322+Aayush501@users.noreply.github.com> Date: Mon, 23 Oct 2023 16:07:04 +0530 Subject: [PATCH] Update ARRAY SPIRAL PRINT (Clockwise) --- it could take some extra space hich would be more than the required space while initilizing the 2D array --- Array/ARRAY SPIRAL PRINT (Clockwise) | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Array/ARRAY SPIRAL PRINT (Clockwise) b/Array/ARRAY SPIRAL PRINT (Clockwise) index 33446d46..a9685e47 100644 --- a/Array/ARRAY SPIRAL PRINT (Clockwise) +++ b/Array/ARRAY SPIRAL PRINT (Clockwise) @@ -41,9 +41,9 @@ void Spiralprint( int a[][1000] , int m , int n){ } } int main(){ - int a[1000][1000] = {0}; int m,n; cin>>m>>n; + int a[m][n] = {0}; int val = 1; for(int row =0; row<= m-1; row++){ for(int col=0; col<=n-1; col++){ @@ -83,4 +83,4 @@ INput:- Output:- 11 12 13 14 15 Note:- In example 2 and example 3 we will get wrong Output but here due to modification(endRow>StartRow , endCol>StartCol) -we are getting right Output...... \ No newline at end of file +we are getting right Output......