You are on page 1of 15

Today's agenda

basics of 2d assays
4 problems
Revise
int C CI an new int 14315
Oh I 2 3 Y

O o o o 0
9

1 O 8 o o o

2,3
O O O
i 2 50

3 O o o o o
J
int i 2 as 2 G

for int j o
j 5 7 7 11 apolislength
4cal length Arlo length
Point anti j
Grow length Art length

arr 2713 50
a Given math ra Point how wise sum

en mat 3 a a 4 3 I 7 is
I 6 2 3 4 15

2 5 3 2 7 17

lint i o i mat length itt


for int Summ o
an

S C OG
Sum Sunt mat i
lj

Point Sum
a Given Square matara Point diagonals R 227
0 I 2 7
to 20 30 no
50 60 70 80
20 100 130
too 110 1120
2 So
130 140 yo y
3
4 4
Obs
0 I 2 2

i 8
3 sow o 61 3
50 60 704,2 6,37

of
1
2 So cog 110 1120
Iz
3
130 140 150 160
Itf
e I 2 3
4x4
Y It
t

s
2 ED
4 Eti
3 y
Gil
7410 5 514,0
j 0

is arriength
int i o
int mattos length 1
j
11 i a matlength Tec Oca
while j 2 0 L
S C OG
Point mat Lij
itt
j
I
a Given a mat a Con Point all diagonals going
Rsl Starting from 0th son
from

O 1 2 3
0 10 20 30 40 10
20 50
1 50 60 70 80
30 60 So
2 90 100 110 120
70 100 130
3
130 110 150 160 Yo

0 I 2 3 4
0 10 20 30 40 170 10

1 50 60 70 80 180 20 50

2 90 100 110 120 190 30 60 9


130 110 150 160 200 Go 70 100 130
3
y 210 220 230 240 250 170 80 110 170 21

hdiagonals can be represented using gaps


I
get get
7
gas3 gap
go

50 60 70 80 180 for intgap O gapematcollerythygaptt


1 int is 09
90 100 110 120 190
2
intj gapg.icxamat.DK
130 110 150 60 200
3 while j o
Y 210 220 230 240 250 Point mat C j
itt
s j
line change
gap 2 gap Y Systemout Daintind

0 2 a
4,87
Hai HH 24
Me Ola
Eto Hype S C OCD
f of
a Given a mat a Ca Point all diagonals going
RSL Starting from last cot
from
0 I 2 3
0 10 20 30 40 Go 70 100 130

1 50 60 70 80 80 110 140
2 90 100 110 120
120 150
130 110 150 60
3 160

0 I 2 3 4
10 20 30 40 170s
4 gary
0 80 110 140 210
80 is agar 1170
50 60 70
180 120
1
2 150 220
90 100 110 120 62,4 tgak2
2 1g 180 160 230
3
130 110 150 160 200763,477gal 3
4200 240
9 210 220 230 240 250 4,4 gap 250

04
94
0 I 2 y 47
3 d l
10 20 30 yo 170
04 gary HE
0 3
Hf L
1 4 89 3 l
1 50 60 70 80 180
12,4 gap 2 27
2 90 100 110 120 1g 41 34
130 110 150 fo zoo 13,4 gap
3
Y 210 220 230 240 250 C 4 gap O t.tt
cha et distinct
int gap math length l
gap o
gap X
for int is math length l gap
int j math length l Ed
while Cismatienga F
Print matli j
itt
j
y
r

int mat length f


for gap 0
inti gap
gap gaptt
int j matto length l

while Cismatiengal
Print Gmat i j
itt
j
a Point all diagonals RSL
from
Hw
Q Given a matata calculate transpose
of mats
with
SCC OCD Convert
every cot into corresponding
good

0 I 2 3
O 10 20 30 40
50
10 go 120
50 60 70 80
20 60 100 140
2 90 100 110 120
30 70 110 150
Yo 80 120 160

far do ij Gi
2 a 20

1,23 BED
3,0 10,3
int n mat length
intra motto length
int i t i n itt f
for I Ocr
lintj.ro jig jtt
for Aswad e c

g with fi S.c Oc
int temp arrfilljl
arolilj argali
arr Gilli temp
Il sectangle 7 non square matin
G implore is not Possible

o
f I transpose o

1,40
n I 4 5 b 2 mom
pay
o 6,0
1
6,1 Co
g gyp
Payne

for int i t ien Sitt f


forlintj O jig jtt t 2050 30899130
t.si
o to

int temp
arrfilljl
arolilj arrfj.fi 21519 109 110 127150
arr Gilli temp 160
y 434 Me 154
Q Rotate 2d matoinmatalnd Clockwise go
by
Leno extra space
0 I 2 3 0 1 2 3
0 10 20 30 40
0 130 90 50 10

1 50 60 70 80 140 100 60 20
1
90 100 110 120 110 70 30
2 2 150
g g g y
g y

fanspose

10 50 90 130 130 90 50 10

20 60 100 140 yo 100 60 20

30 20 110 150 150 110 70 30


40 80 120 160 160 120 80 40

Is code have to write


you
Q Rotate 2d matoinmatalndantiClockwise go
Leno extra space
by

j j
10 20 30 40 0 I 23
0
o yo 80 120 160
a

g g g

3
I g

10
g
50
p
go
p
130

Ganspose

10 50 90 130 Yo 80 120 16
20 60 100 140 30 70 110 150
Jo 70 110 150 20 60 100 170
40 80 120 160 10 50 90 130

memorize every techinge


t
revise things regularly

ima lot
won't be writing code
what to got
impt
Sen CB
Doubts go even length

subway 1 odd length Son B

ar Li i is
Plan L 10 11 17 21 23 32

length e Stl
2Mt any 2
my i i 2 3 4 5
am L o i 10 1 03 sold

0 I 0

I 0

You might also like