I solved GCD's all approaches and also solved LCM public class R9_GCD { //Brute force approach static int BruteGCD(int x, int y){ //finding the greatest common divisor int min = Math.min(x,y); int max = 0; for(int i = min ; i >= 1; i--){ if(x % i == 0 && y % i == 0 && max < i){ max = i; } } return max; } //Iterative way static int iterativeGGD(int x, int y){ //it doesn't matter which num is great if y > x then x % y = 0, it changes the value to y = x while (x % y != 0){ int rem = x % y; x = y; y = rem; } return y; } //Euclid's Algorithm static int EuclidGCD(int x, int y){ if(y == 0) return x; return EuclidGCD(y,x%y); } //LCM static int LCM(int x, int y){ //formula is [ LCM * GCD = X * Y or LCM = (X * Y) / GCD ] return (x * y) / EuclidGCD(x,y); } public static void main(String[] args) { int x = 12, y = 16; System.out.println("By Brute force approach : " + BruteGCD(x,y)); System.out.println("By Iterative way : " + iterativeGGD(x,y)); System.out.println("By Euclid's algorithm : " + EuclidGCD(x,y)); System.out.println("LCM is : " + LCM(x,y)); } } Output : By Brute force approach : 4 By Iterative way : 4 By Euclid's algorithm : 4 LCM is : 48
sorry for late but finally lec 31 is completed. mam mera college exam aa rha hai jiske karan meri consistency thoda kharab ho rhi hai . lekin mam mai puri kosis karunga ki mai consistent rhu. jb yudh me entry le he leya hai to yudh ko jeet ke bhi niklange. mam you are really awesome
Brute Force Approach Mam Wants Us To Do :( static int bruteForceGcd2(int num1 , int num2){ // some necessary conditions when we do not have to do iterations over the numbers if(num1==0 && num2!=0) return num2; else if(num2==0 && num1!=0) return num1; else if(num1==0 && num2==0) return 0; // using min number for iteration int minNum = 0; // using ans variable to store the gcd of the two numbers int ans = 0; // finding min number using if-else if(num10; i--){ if(num1%i==0 && num2%i==0){ ans = i; break; } }
@@indianengineer5802 nehi tuma programmer ban na chahate ho to long time and slowly sedule follow kara agar aap coder banna chahete ho to short term time lelo
this method is not work well to find LCM plz guide // method 1 iterative approach issue with this approach //formula is [ LCM * GCD = X * Y or LCM = (X * Y) / GCD ] static int iGCD(int x, int y){ while (x%y!=0){ int rem=x%y; x=y; y=rem; } return y; } static int iLCM(int x, int y){ return (x*y)/y; } public static void main(String[] args) { Scanner sc=new Scanner((System.in)); System.out.println("enter 1st number"); int a= sc.nextInt(); System.out.println("enter 2nd number"); int b= sc.nextInt(); System.out.println("result of method 1"); System.out.println(iLCM(a,b)); //output enter 1st number 50 enter 2nd number 20 result of method 1 50
@shivamkrgupta3230 bro it's been 2.5 months she started DSA, and solving recursion problems 🙂. Looks like you're learning it for first time. Stack queue tak toh 6 mahine le lengi ye 🙂
PW Skills is announcing the launch of the following programs,
Binary Batch:- Java-with-DSA-&-System-Design (Java with DSA & System Design)
pwskills.com/course/Java-with-DSA-and-system-design (Hindi)
pwskills.com/course/Java-with-DSA-and-System-Design (English)
Sigma Batch:- Full-Stack-Web-Development (MERN Stack)
pwskills.com/course/Full-Stack-web-development (Hindi)
pwskills.com/course/Full-Stack-Web-Development (English)
Impact Batch:- Data-Science-Masters (Full Stack Data Science)
pwskills.com/course/Data-Science-masters (Hindi)
pwskills.com/course/Data-Science-Masters (English)
Maam plz upload video regularly .I know ur were busy .. And tq for this lecture.
aisa teacher kabhi nhi dekha yaar most compicated topics ko v hum jaise bache ko ye feel kara di ki ye sab toh bacho ka khel h ,hats of mam
Thanks To Mam for incredible explanation.
1) gcd(x,y) = gcd(y,x%y) recursive relation
2) gcd(x,o) = x base case
3) lcm(x,y) = x*y / (gcd(x,y))
Its to much clear and helping class. 😊😍
Thank you mam for your consistency please complete this course as per syllabus in time🙏🙏🙏
best course ever
Thank you ma'am ☺️
Please maintain consistency in uploading the lectures
brother she is an engineer in Google she also has work .. if you r interested in fast learning you can follow saurav shukla sir lectures or telusko
Bro do you have notes of this course
Mam please upload lectures
daily.
Please upload, routine wise video 🙏
I solved GCD's all approaches and also solved LCM
public class R9_GCD {
//Brute force approach
static int BruteGCD(int x, int y){
//finding the greatest common divisor
int min = Math.min(x,y);
int max = 0;
for(int i = min ; i >= 1; i--){
if(x % i == 0 && y % i == 0 && max < i){
max = i;
}
}
return max;
}
//Iterative way
static int iterativeGGD(int x, int y){
//it doesn't matter which num is great if y > x then x % y = 0, it changes the value to y = x
while (x % y != 0){
int rem = x % y;
x = y;
y = rem;
}
return y;
}
//Euclid's Algorithm
static int EuclidGCD(int x, int y){
if(y == 0) return x;
return EuclidGCD(y,x%y);
}
//LCM
static int LCM(int x, int y){
//formula is [ LCM * GCD = X * Y or LCM = (X * Y) / GCD ]
return (x * y) / EuclidGCD(x,y);
}
public static void main(String[] args) {
int x = 12, y = 16;
System.out.println("By Brute force approach : " + BruteGCD(x,y));
System.out.println("By Iterative way : " + iterativeGGD(x,y));
System.out.println("By Euclid's algorithm : " + EuclidGCD(x,y));
System.out.println("LCM is : " + LCM(x,y));
}
}
Output :
By Brute force approach : 4
By Iterative way : 4
By Euclid's algorithm : 4
LCM is : 48
In Brute force approach the variable max should be gcd..
❤🔥❤🔥thankyou maam
Check this number is armstrong or not using recursion..
import java.util.Scanner;
class Recurrision{
static int armstrong(int n){
if(n >=0 && n
this code run for only three digit number.What about four digit number?
mam please upload regularly video just like previous year
grinding everyday
sorry for late but finally lec 31 is completed. mam mera college exam aa rha hai jiske karan meri consistency thoda kharab ho rhi hai . lekin mam mai puri kosis karunga ki mai consistent rhu. jb yudh me entry le he leya hai to yudh ko jeet ke bhi niklange. mam you are really awesome
static int GreatesstCommon(int x,int y){
int a=Math.min(x, y);
do {
a--;
}while (x%a!=0 || y%a!=0);
return a;
}
brute force approach
Long Divison Approach To Find Gcd (optimised one) :
static int bruteForceGcd3 (int num1 , int num2){
// long division approach
// necessary condition num2 < num1
if(num1==0 && num2!=0) return num2;
else if(num2==0 && num1!=0) return num1;
else if(num1==0 && num2==0) return 0;
if(num2
Assignment not available in website
❤
Hello mam
Mam apke lecture me kadance algorithm upload kab kar rahe hain ?
When digital marketing course will start plz tell me
Brute Force Approach Mam Wants Us To Do :(
static int bruteForceGcd2(int num1 , int num2){
// some necessary conditions when we do not have to do iterations over the numbers
if(num1==0 && num2!=0) return num2;
else if(num2==0 && num1!=0) return num1;
else if(num1==0 && num2==0) return 0;
// using min number for iteration
int minNum = 0;
// using ans variable to store the gcd of the two numbers
int ans = 0;
// finding min number using if-else
if(num10; i--){
if(num1%i==0 && num2%i==0){
ans = i;
break;
}
}
return ans;
}
How to I download notes & pdfs.....?
how can i download notes from 29th class to today till
Marking my attendance
Mam can you please try to upload more lectures thank you
Try to upload daily.
Leetcode series bhi ni aa rhe.
Can't access notes and assignments
Mam very soon we meet in binary Hindi batch
binary java course me DSA problem solving lecture ayenge kya schedule me nhi diye
PW ke helpline no pe puch le bhai
@@Sehore_Defence_Academy beginner se lekar ke advance tok chale ga bas aap ko motivate or dedication dikhana hai hai bas utne mai Kam ban jaye ga
@@notaproblem7770 am already purchased bro
✅✅
Day 2 of recursion prac 23 sept
Ab Tak to khatam ho gya hoga apka DSA
How to become a white hat hacker please tell
Mam thumbnail fibbonaccci ka laga rkha hai
day 6 of maintaining consistency :(
How to write ≠
!=
!=
!=
!= Ko likh ke
Ma'am DSA ka course poora hoga ya nhi
Bhai ense mat pado learning pace bhaut slow ho jaega..... Find some other substitute on RUclips or go for some paid course.
@@indianengineer5802 nehi tuma programmer ban na chahate ho to long time and slowly sedule follow kara agar aap coder banna chahete ho to short term time lelo
@@janmejaysahu9011 aapne toh meri aankhen khol dii 🐻
@@indianengineer5802 😂😂😂
anybody got the time complexity of euclids gcd :(
this method is not work well to find LCM plz guide
// method 1 iterative approach issue with this approach
//formula is [ LCM * GCD = X * Y or LCM = (X * Y) / GCD ]
static int iGCD(int x, int y){
while (x%y!=0){
int rem=x%y;
x=y;
y=rem;
}
return y;
}
static int iLCM(int x, int y){
return (x*y)/y;
}
public static void main(String[] args) {
Scanner sc=new Scanner((System.in));
System.out.println("enter 1st number");
int a= sc.nextInt();
System.out.println("enter 2nd number");
int b= sc.nextInt();
System.out.println("result of method 1");
System.out.println(iLCM(a,b));
//output
enter 1st number
50
enter 2nd number
20
result of method 1
50
store y(gcd ans) at different variable
Pw skill website is not working....
Help....
are you able to access Assignments
@@gunagantivinod5294 No
Dimag kharab hai kya.... Etna lamba kra rhe course faltu mein.... Please don't upload if you want to waste the time of begginers
@shivamkrgupta3230 bro it's been 2.5 months she started DSA, and solving recursion problems 🙂. Looks like you're learning it for first time. Stack queue tak toh 6 mahine le lengi ye 🙂
@shivamkrgupta3230 let's see, we all are here 🙂
@shivamkrgupta3230 mujhe aata hai bhai I am placed 🙂
@shivamkrgupta3230 Deutsche Bank
@shivamkrgupta3230 maine python se kiya hai