This question was asked in a Microsoft interview 2 years back.
On Mon, Jun 7, 2010 at 8:05 PM, divya jain sweetdivya@gmail.com wrote:
let a[n][n] be the input array nd b[][] be the output
for(i=0;in;i++)
for(j=0;jn;j++)
b[i][j]=a[n-j-1][n-i-1]
On 7 June 2010 08:26,
#includeiostream
using namespace std;
int main(){
int a[4][4]={1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16};
int i=0,j,n=3,l=0,m=n;
j=n;
while(i=n){
int i1=i,j1=j,k=0,l=n;
for(;kj1;i1++,j1--){
swap(a[k][i1],a[j1][l]);
if(i!=0){
@Sharad,
3 4 5
A= 6 7 9
1 2 8
If B[i,j] = A[n-j, n-i]
then
---
8 9 5
B = 2 7 4
1 6 3
Mohit Ranjan
On Mon, Jun 7, 2010 at 8:26 AM, sharad sharad20073...@gmail.com wrote:
write
let a[n][n] be the input array nd b[][] be the output
for(i=0;in;i++)
for(j=0;jn;j++)
b[i][j]=a[n-j-1][n-i-1]
On 7 June 2010 08:26, sharad sharad20073...@gmail.com wrote:
write a c routine to flip an nXn matrix about its non major diagnol
3 4 5
6 7 9