0% found this document useful (0 votes)
8 views

Solving Pattern Questions (Part-2)

a good dsa practice
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Solving Pattern Questions (Part-2)

a good dsa practice
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

so we can see that every element has

indexing of row and column and fiding a relationship


between i an j and n will help us to control how many
times to execute j's while loop and also if in a row itslelf
different things like stars ,spaces ,digits are to be printed
Pattern Questions (Part- 2) according to question then we know every differented type's
09 January 2022 19:06
relation with i j and n for loops and then print like in pyramid and thr last question of thid
i=1 i=2 i=3 i=4
j=1 1,1 1,2 1,3 1,4
lats 2,1 2,2 2,3 2,4
j=2 3,1 3,2 3,3 3,4

4,1 4,2 4,3 4,4


j=4

Type your text

Type your text

Solving Pattern Questions (Part-2) Page 1


note:
here i refers to row i.e we are
entering in a particular row
and j refers to a coloumn or accurately
a element in in a row .We are
acessing each element in a row by j
so we find a relationship between
number of rows (i.e. for i range)
and j(how many elements in each row
as each rows may have different elements
as in 1st row may have 1 and 2nd may have
2 and so on or maybe a row has first some
numbers and it is occuring how many times
is related to rows and coloumn relation and
then may have starts and its appearance are also rel
to which coloumn and row it belomgs to and so on

Type you
Typeyour
you
Type
Type your text
Type you

Solving Pattern Questions (Part-2) Page 2


Solving Pattern Questions (Part-2) Page 3
Solving Pattern Questions (Part-2) Page 4
More Patterns
09 January 2022 20:06

Solving Pattern Questions (Part-2) Page 5


Solving Pattern Questions (Part-2) Page 6
Solving Pattern Questions (Part-2) Page 7
note: here at 1,1 index no stars are there and if we print star i times directly then
pattern will change as stars will get starting printing from 1,1 in 1st row and then in 2nd row 1,1 ,1,2 and in third and so on
but there are some spaces first so first print thta by finding a relationship between i,j and n
and then run loop to how many times print it
so in short in patterns print in order left to right and for every different character within a row find how many times that character
appeared by finding a relation with n,i and j and do that for every different character or when pattern is changing within a row
and run various different loops( for every new charcter or new pattern within a row indended )in i(row)loop.

Solving Pattern Questions (Part-2) Page 8


Solving Pattern Questions (Part-2) Page 9
Solving Pattern Questions (Part-2) Page 10
Solving Pattern Questions (Part-2) Page 11
Solving Pattern Questions (Part-2) Page 12

You might also like