Rotate matrix in c++

Is https://ide.codingblocks.com/s/330848 this code more efficient than https://ide.codingblocks.com/s/330849 this code?
Please tell me how efficient they are and which one is a better implementation?

hello @Sharleen-Clement-3051084341644767 both the codes are efficient in their own way because in the first code your are using your logic to rotate the image and in the second code you are using trick to directly print the desired result .
but i would suggest you if you have written the codes yourself then go with the first code only because you should not only concentrate on the printing part .
i hope i have cleared your doubt .
Happy Learning !!

1 Like