9 Best Patterns Questions In Java (for Beginners) | Java Placement Course | Lecture 5

preview_player
Показать описание
Time Stamps for Patterns
Solid Rectangle & Nested Loops - 00:35
Hollow Rectangle - 10:38
Half Pyramid - 18:23
Inverted half Pyramid - 23:47
Inverted & Rotated Half Pyramid - 26:50
Half Pyramid with Numbers - 33:45
Inverted Half Pyramid with Numbers - 38:21
Floyd's Triangle - 44:36
0-1 Triangle - 48:45

(It is not important to remember the names)

Рекомендации по теме
Комментарии
Автор

Time Stamps for important points 🧑‍💻

Pattern 01 (Solid Rectangle) -> 0:50
Pattern 02(Hollow Rectangle) -> 10:38
Pattern 03(Half Pyramid) -> 18:23
Pattern 04(Inverted Half Pyramid) -> 23:47
Pattern 05(Inverted & rotated half pyramid) -> 26:50
Pattern 06(Half Pyramid with Num) -> 33:45
Pattern 07(Inverted half Pyramid with Num) -> 38:21
Pattern 08(Flyod's Triangle) -> 44:36
Pattern 09 -> 48:45

sourikkarmakar
Автор

code for right angled triangle flipped by 180 degrees:
for(int i=1;i<=4;i++){
for(int j=1;j<=4;j++){
if(j<=4-i)
System.out.print(" ");
else System.out.print("*");
}
System.out.println();
}

darshanshah
Автор

7th Question) Code for alternate half pyramid w/ numbers can also be:
int n=5;
for(int i=5;i>=1;i--){
for(int j=1;j<=i;j++){
System.out.print(j+" ");
}System.out.println();
}

mansishinde
Автор

The 9th question can be done in another approach/way:-

int k=1;
for(int i=0;i<m;i++){
for(int j=0;j<m;j++)
{if(j<=i)
System.out.print(k+ " ");
if(k==1)
k=0;
else
k=1;
}
System.out.println();
}

_ashutoshdas
Автор

for inverted and rotated half pyramid (using 2 for loops instead of 3 )
int m = 4;
int n = 4;
for (int i = 1; i < m + 1; i++) {
for (int j = 1; j < n + 1; j++) {
if (i + j > n) {
System.out.print("*");
} else {
System.out.print(" ");
}
}
System.out.println();
}

rajanpoudel
Автор

I'm still shocked these videos are free. Thank you bhaiya and didi, you guys have all my respect and love❤

sreyabhowmick
Автор

Effort being put while explaining any part is commendable!

rishabhgupta
Автор

Row is Horizontal allignment
Columns is Vertical Allignment

Ankii
Автор

This lecture really helped me a lot, I solved 50+ questions of JAVA patterns after seeing it. Thanks for such interesting lectures

itsnewday
Автор

The effort you are putting is something that i cannot explain how good it is, also i want to thank you cause now i think i will be able to learn programming. Please make this series a complete series for java beginner to end.

soujanyakalita
Автор

The way she explain is what I expect from my college teachers but they don't ....thank u shoo much for giving so much perfectionist in your lecture

shaikhaliya
Автор

You explain really well! The way how you show what is actually happening in the code makes it easy to understand. Thanks!

avaneeshshetye
Автор

pattern 1:
(other method)

public class Patterns {
public static void main(String[] args) {

int row = 6;
int column = 9;

for(int i = 1; i<=row; i++) {
String result = "*".repeat(column);
System.out.println(result);
}
}

}

Calculasian
Автор

Please please please dont stop this series.... Aap sabse best Samjhati ho....
Ek bar bhi na pausa karna padta h... Na hi back karna padhta Sidha dimag m ghusta jata h... Too good... 1000likes for this video..
We friends are eagerly waiting for your video... So please dont stop this series

subhammishra
Автор

the fourth question is also be solved as (inverted half pyramid )
for(int i=1;i<=m;i++){
for(int j=m;j>=i;j--){
System.out.print("* ");
}
System.out.println();
}
you will get the same output by using another logic.

surajkumarsingh
Автор

The 6th, 7th and 8th questions can be done in another approach/way:-

For q6)
for(int i=0;i<m;i++){
for(int j=0;j<m;j++)
{if(j<=i)
System.out.print( j+1 + " " ); }
System.out.println();
}

for q7)
for(int i=0;i<m;i++){
for(int j=0;j<m;j++)
{if(j<=(m-i-1))
System.out.print(j+1+" ");
else
System.out.print(" ");
}
System.out.println();
}

}
}

for q8)
int k=0;
for(int i=0;i<m;i++){
for(int j=0;j<m;j++)
{if(j<=i)
{
System.out.print(k+1 +" ");
k++;
}
// else
// System.out.print(" ");
}
System.out.println();
}

}
}

_ashutoshdas
Автор

Didi aap bahut accha smjhati hai,
Hamare school wale sir se bhi accha smjhati hai
thank you
🙂🙂🙂

jaycreation
Автор

for prime, i think condition i*i<n would consume less time.

Rieshu-sm
Автор

Note for viewers : if anyone is using an older version of JDK then you will face problems, just now I faced a problem with pattern no 5 (Inverted & Rotated Half Pyramid) I was using JDK-8u28 and it was not showing actual output. Later i updated to JDK's latest version and the problem was solved.

Note -The code was perfect, I have even used a java visualizer for confirmation.

ujwalsadharia
Автор

42:37 For this Pattern you can also write it in the following way-
for(int i=4;i>=0;i- -){
for(int j=1;j<=i;j++){
System.out.print(j);
}
System.out.println();
}

hppavilionlap