├── Assignments ├── README.md ├── 01-flow-of-program │ ├── Q.4 HCF & LCM.png │ ├── Q.5 Sum of n numbers.png │ ├── Q.1 Checking leap year.png │ ├── Q.2 Sum of two numbers.png │ ├── Q.3 Multiplication table.png │ └── README.md ├── 03-conditionals-loops │ ├── Intermediate │ │ ├── Q_26.java │ │ ├── Q_10.java │ │ ├── Q_25.java │ │ ├── Q_14.java │ │ ├── Q_20.java │ │ ├── Q_24.java │ │ ├── Q_13.java │ │ ├── Q_21.java │ │ ├── Q_17.java │ │ ├── Q_22.java │ │ ├── Q_3.java │ │ ├── Q_23.java │ │ ├── Q_7.java │ │ ├── Q_19.java │ │ ├── Q_1.java │ │ ├── Q_16.java │ │ ├── Q_18.java │ │ ├── Q_9.java │ │ ├── Q_12.java │ │ ├── Q_8.java │ │ ├── Q_4.java │ │ ├── Q_11.java │ │ ├── Q_2.java │ │ ├── Q_5.java │ │ ├── Q_15.java │ │ ├── Q_27.java │ │ ├── Q_6.java │ │ └── README.md │ ├── Basic │ │ ├── Q_22.java │ │ ├── Q_1.java │ │ ├── Q_12.java │ │ ├── Q_20.java │ │ ├── Q_13.java │ │ ├── Q_8.java │ │ ├── Q_9.java │ │ ├── Q_17.java │ │ ├── Q_7.java │ │ ├── Q_15.java │ │ ├── Q_3.java │ │ ├── Q_23.java │ │ ├── Q_5.java │ │ ├── Q_14.java │ │ ├── Q_2.java │ │ ├── Q_10.java │ │ ├── Q_11.java │ │ ├── Q_16.java │ │ ├── Q_19.java │ │ ├── Q_4.java │ │ ├── Q_21.java │ │ ├── Q_6.java │ │ ├── Q_24.java │ │ ├── Q_25.java │ │ ├── Q_18.java │ │ └── README.md │ └── README.md ├── 05-arrays │ ├── Easy │ │ ├── Q_1.java │ │ ├── Q_2.java │ │ ├── Q_3.java │ │ ├── Q_16.java │ │ ├── Q_10.java │ │ ├── Q_7.java │ │ ├── Q_4.java │ │ ├── Q_9.java │ │ ├── Q_5.java │ │ ├── Q_6.java │ │ ├── Q_8.java │ │ ├── Q_13.java │ │ └── Q_21.java │ └── README.md ├── 02-first-java │ ├── Q_6.java │ ├── Q_2.java │ ├── Q_1.java │ ├── Q_7.java │ ├── Q_5.java │ ├── Q_8.java │ ├── Q_3.java │ ├── README.md │ ├── Q_9.java │ └── Q_4.java └── 04-functions │ ├── Q_10.java │ ├── Q_14.java │ ├── Q_4.java │ ├── Q_5.java │ ├── Q_9.java │ ├── Q_2.java │ ├── Q_3.java │ ├── Q_6.java │ ├── Q_7.java │ ├── Q_13.java │ ├── Q_12.java │ ├── Q_8.java │ ├── Q_1.java │ └── README.md ├── Lectures ├── 08-arrays │ ├── README.md │ ├── Notes │ │ ├── README.md │ │ ├── 1D_arrays.png │ │ ├── 2D_arrays.png │ │ ├── arraylist.png │ │ └── Handwritten notes on arrays and arraylist.pdf │ └── Code │ │ ├── PassinginFunctions.java │ │ ├── ColNoFixed.java │ │ ├── MultiAL.java │ │ ├── Swap.java │ │ ├── Max.java │ │ ├── ArrayListExample.java │ │ ├── Main.java │ │ ├── Input.java │ │ └── MultiDimension.java ├── 01-git │ ├── Git GitHub Notes.pdf.pdf │ ├── Git__GitHub_102_modified.pdf │ └── git-cheat-sheet-education.pdf ├── 06-conditions-loops │ ├── Notes │ │ ├── switch.png │ │ ├── Conditionals_And_Loops.pdf │ │ └── Handwritten notes switch cases.pdf │ ├── Conditionals Codes │ │ ├── Reverse.java │ │ ├── CountNums.java │ │ ├── CaseCheck.java │ │ ├── Fibo.java │ │ ├── Largest.java │ │ ├── Conditionals.java │ │ ├── Loops.java │ │ └── Calculator.java │ └── Switch Codes │ │ ├── Main.java │ │ └── NestedSwitch.java ├── 03-flow of program │ ├── Flow_Of_Program_Notes.pdf │ └── Handwritten notes Flow of program.pdf ├── 02-intro to programming │ ├── Intro_to_Programming_Notes.pdf │ └── Handwritten notes Introduction to Programming Languages.pdf ├── 04-introduction to java │ ├── Introduction_to_Java_Notes.pdf │ └── Handwritten notes Introduction to Java.pdf ├── 05-first-java-program │ ├── Notes │ │ ├── First_Java_Program_Notes.pdf │ │ ├── Handwritten notes Lecture 5.pdf │ │ └── type_conversion&casting.txt │ └── Codes │ │ ├── Main.java │ │ ├── Sum.java │ │ ├── Temperature.java │ │ ├── Primitives.java │ │ ├── Basics.java │ │ ├── Inputs.java │ │ ├── Prime.java │ │ └── TypeCasting.java ├── 07-methods │ ├── Notes │ │ └── Handwritten notes on functions and methods.pdf │ └── Codes │ │ ├── Greeting.java │ │ ├── PassingExample.java │ │ ├── ChangeValue.java │ │ ├── Shadowing.java │ │ ├── VarArgs.java │ │ ├── Overloading.java │ │ ├── StringExample.java │ │ ├── Swap.java │ │ ├── Questions.java │ │ ├── Scope.java │ │ ├── Sum.java │ │ └── Main.java └── README.md ├── CONTRIBUTION.md ├── LICENSE └── README.md /Assignments/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Lectures/08-arrays/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Notes/README.md: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /Lectures/01-git/Git GitHub Notes.pdf.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/01-git/Git GitHub Notes.pdf.pdf -------------------------------------------------------------------------------- /Lectures/08-arrays/Notes/1D_arrays.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/08-arrays/Notes/1D_arrays.png -------------------------------------------------------------------------------- /Lectures/08-arrays/Notes/2D_arrays.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/08-arrays/Notes/2D_arrays.png -------------------------------------------------------------------------------- /Lectures/08-arrays/Notes/arraylist.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/08-arrays/Notes/arraylist.png -------------------------------------------------------------------------------- /Lectures/01-git/Git__GitHub_102_modified.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/01-git/Git__GitHub_102_modified.pdf -------------------------------------------------------------------------------- /Lectures/01-git/git-cheat-sheet-education.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/01-git/git-cheat-sheet-education.pdf -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Notes/switch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/06-conditions-loops/Notes/switch.png -------------------------------------------------------------------------------- /Assignments/01-flow-of-program/Q.4 HCF & LCM.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Assignments/01-flow-of-program/Q.4 HCF & LCM.png -------------------------------------------------------------------------------- /Assignments/01-flow-of-program/Q.5 Sum of n numbers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Assignments/01-flow-of-program/Q.5 Sum of n numbers.png -------------------------------------------------------------------------------- /Lectures/03-flow of program/Flow_Of_Program_Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/03-flow of program/Flow_Of_Program_Notes.pdf -------------------------------------------------------------------------------- /Assignments/01-flow-of-program/Q.1 Checking leap year.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Assignments/01-flow-of-program/Q.1 Checking leap year.png -------------------------------------------------------------------------------- /Assignments/01-flow-of-program/Q.2 Sum of two numbers.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Assignments/01-flow-of-program/Q.2 Sum of two numbers.png -------------------------------------------------------------------------------- /Assignments/01-flow-of-program/Q.3 Multiplication table.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Assignments/01-flow-of-program/Q.3 Multiplication table.png -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Notes/Conditionals_And_Loops.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/06-conditions-loops/Notes/Conditionals_And_Loops.pdf -------------------------------------------------------------------------------- /Lectures/02-intro to programming/Intro_to_Programming_Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/02-intro to programming/Intro_to_Programming_Notes.pdf -------------------------------------------------------------------------------- /Lectures/03-flow of program/Handwritten notes Flow of program.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/03-flow of program/Handwritten notes Flow of program.pdf -------------------------------------------------------------------------------- /Lectures/04-introduction to java/Introduction_to_Java_Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/04-introduction to java/Introduction_to_Java_Notes.pdf -------------------------------------------------------------------------------- /Lectures/05-first-java-program/Notes/First_Java_Program_Notes.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/05-first-java-program/Notes/First_Java_Program_Notes.pdf -------------------------------------------------------------------------------- /Lectures/05-first-java-program/Notes/Handwritten notes Lecture 5.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/05-first-java-program/Notes/Handwritten notes Lecture 5.pdf -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Notes/Handwritten notes switch cases.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/06-conditions-loops/Notes/Handwritten notes switch cases.pdf -------------------------------------------------------------------------------- /Lectures/08-arrays/Notes/Handwritten notes on arrays and arraylist.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/08-arrays/Notes/Handwritten notes on arrays and arraylist.pdf -------------------------------------------------------------------------------- /Lectures/07-methods/Notes/Handwritten notes on functions and methods.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/07-methods/Notes/Handwritten notes on functions and methods.pdf -------------------------------------------------------------------------------- /Lectures/04-introduction to java/Handwritten notes Introduction to Java.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/04-introduction to java/Handwritten notes Introduction to Java.pdf -------------------------------------------------------------------------------- /Lectures/02-intro to programming/Handwritten notes Introduction to Programming Languages.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/kishanrajput23/Java-DSA-Bootcamp/HEAD/Lectures/02-intro to programming/Handwritten notes Introduction to Programming Languages.pdf -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_26.java: -------------------------------------------------------------------------------- 1 | public class Q_26 { 2 | public static void main(String[] args) { 3 | System.out.println("Number of Days kunal can go out in the month of August are : "+(31/2)); 4 | } 5 | } 6 | -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/Greeting.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class Greeting { 4 | public static void main(String[] args) { 5 | greeting(); 6 | } 7 | static void greeting() { 8 | System.out.println("Hello World"); 9 | } 10 | } 11 | -------------------------------------------------------------------------------- /Assignments/05-arrays/Easy/Q_1.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public int[] buildArray(int[] nums) { 3 | int arr[] = new int[nums.length]; 4 | for(int i=0;i0) { 6 | int temp = n%10; 7 | sum += temp; 8 | product *= temp; 9 | n /= 10; 10 | } 11 | return product - sum; 12 | } 13 | } -------------------------------------------------------------------------------- /Assignments/02-first-java/Q_2.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_2 { 4 | public static void main(String args[]) { 5 | Scanner input = new Scanner(System.in); 6 | 7 | System.out.println("Enter the name : "); 8 | 9 | String name = input.nextLine(); 10 | 11 | System.out.println("Hello " + name + " Welcome to my world!."); 12 | } 13 | } -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_1 { 4 | public static void main(String[] args) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the circle radius : "); 7 | float radius = in.nextFloat(); 8 | System.out.println("The area of circle is " + (3.14 * radius * radius)); 9 | } 10 | } -------------------------------------------------------------------------------- /Assignments/05-arrays/Easy/Q_10.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public boolean checkIfPangram(String sentence) { 3 | if(sentence.length() < 26) { 4 | return false; 5 | } 6 | for(char c='a'; c<='z'; c++) { 7 | if(!sentence.contains(""+c)) { 8 | return false; 9 | } 10 | } 11 | return true; 12 | } 13 | } -------------------------------------------------------------------------------- /Assignments/05-arrays/Easy/Q_7.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public int numIdenticalPairs(int[] nums) { 3 | int count = 0; 4 | for (int i=0; i list = new ArrayList(); 4 | for(int i=0;i kidsWithCandies(int[] candies, int extraCandies) { 3 | List arr = new ArrayList<>(); 4 | int maxi = 0; 5 | for (int i=0; i= maxi - extraCandies); 10 | } 11 | return arr; 12 | } 13 | } -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_17.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_17 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the radius of sphere"); 7 | float radius = in.nextFloat(); 8 | double volume = (4 * 3.14* radius * radius * radius) / 3; 9 | System.out.println("The volume of sphere is " + volume); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_7.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_7 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the side of equilateral traingle"); 7 | float side = in.nextFloat(); 8 | double area = (Math.sqrt(3) * side * side) / 4; 9 | System.out.println("The area of equilateral traingle is " + area); 10 | } 11 | } 12 | -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Conditionals Codes/CountNums.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class CountNums { 4 | public static void main(String[] args) { 5 | int n = 45535; 6 | 7 | int count = 0; 8 | while (n > 0) { 9 | int rem = n % 10; 10 | if (rem == 5) { 11 | count++; 12 | } 13 | n = n / 10; // n /= 10 14 | } 15 | 16 | System.out.println(count); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Conditionals Codes/CaseCheck.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class CaseCheck { 6 | public static void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | char ch = in.next().trim().charAt(0); 9 | 10 | if (ch >= 'a' && ch <= 'z') { 11 | System.out.println("Lowercase"); 12 | } else { 13 | System.out.println("Uppercase"); 14 | } 15 | 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_25.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_25 { 4 | public static void main(String[] args) { 5 | Scanner input = new Scanner(System.in); 6 | System.out.print("Enter number : "); 7 | int n = input.nextInt(); 8 | 9 | long sum =0; 10 | while(n>0){ 11 | sum+=n%10; 12 | n=n/10; 13 | } 14 | System.out.println("Sum : "+sum); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Assignments/02-first-java/Q_1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_1 { 4 | public static void main(String args[]) { 5 | Scanner input = new Scanner(System.in); 6 | 7 | System.out.println("Enter the number : "); 8 | int num = input.nextInt(); 9 | 10 | if(num%2==0) { 11 | System.out.println(num + " is an Even Number."); 12 | } 13 | else { 14 | System.out.println(num + " is Odd Number."); 15 | } 16 | } 17 | } -------------------------------------------------------------------------------- /Assignments/05-arrays/Easy/Q_8.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public int[] smallerNumbersThanCurrent(int[] nums) { 3 | int arr[] = new int[nums.length]; 4 | int count = 0; 5 | for (int i=0; i nums[j]) { 8 | count += 1; 9 | } 10 | } 11 | arr[i] = count; 12 | count = 0; 13 | } 14 | return arr; 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/ChangeValue.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Arrays; 4 | 5 | public class ChangeValue{ 6 | public static void main(String[] args) { 7 | // create an array 8 | int[] arr = {1, 3, 2, 45, 6}; 9 | change(arr); 10 | System.out.println(Arrays.toString(arr)); 11 | } 12 | 13 | static void change(int[] nums) { 14 | nums[0] = 99; // if you make a change to the object via this ref variable, same object will be changed 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Code/ColNoFixed.java: -------------------------------------------------------------------------------- 1 | public class ColNoFixed { 2 | public static void main(String[] args) { 3 | int[][] arr = { 4 | {1, 2, 3, 4}, 5 | {5, 6}, 6 | {7, 8, 9} 7 | }; 8 | 9 | for (int row = 0; row < arr.length; row++) { 10 | for (int col = 0; col < arr[row].length; col++) { 11 | System.out.print(arr[row][col] + " "); 12 | } 13 | System.out.println(); 14 | } 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /Assignments/05-arrays/Easy/Q_13.java: -------------------------------------------------------------------------------- 1 | class Solution { 2 | public int[][] flipAndInvertImage(int[][] image) { 3 | for(int i=0;i0) { 7 | sum += X%10; 8 | X /= 10; 9 | } 10 | 11 | X = sum; 12 | while (X>0) { 13 | rev = rev*10 + X%10; 14 | X /= 10; 15 | } 16 | 17 | if (rev==sum) { 18 | return 1; 19 | } 20 | else { 21 | return 0; 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_5.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_5 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the base of the parallelogram"); 7 | float base = in.nextFloat(); 8 | System.out.println("Enter the height of the parallelogram"); 9 | float height = in.nextFloat(); 10 | float area = base * height; 11 | System.out.println("The area of parallelogram is " + area); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Conditionals Codes/Fibo.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Fibo { 6 | public static void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | int n = in.nextInt(); 9 | int a = 0; 10 | int b = 1; 11 | int count = 2; 12 | 13 | while (count <= n) { 14 | int temp = b; 15 | b = b + a; 16 | a = temp; 17 | count++; 18 | } 19 | 20 | System.out.println(b); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_14.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_14 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the radius of cone"); 7 | float radius = in.nextFloat(); 8 | System.out.println("Enter the height of cone"); 9 | float height = in.nextFloat(); 10 | double volume = (3.14 * radius * radius * height) / 3; 11 | System.out.println("The volume of cone is " + volume); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_2.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_2 { 4 | public static void main(String args[]) { 5 | Scanner input = new Scanner(System.in); 6 | System.out.println("Enter the base of a triangle"); 7 | double base = input.nextDouble(); 8 | System.out.println("Enter the height of a triangle"); 9 | double height = input.nextDouble(); 10 | double area = 0.5 * base * height; 11 | System.out.println("The area of the traingle is " + area); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_14.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_14 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Enter a number : "); 7 | int num = sc.nextInt(); 8 | 9 | System.out.print("The sum of " + num + " natural numbers are " + sum(num)); 10 | } 11 | 12 | public static int sum(int num) { 13 | int T=0; 14 | for (int i=0; i<=num; i++) { 15 | T += i; 16 | } 17 | return T; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_10.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_10 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the base of parallelogram"); 7 | float base = in.nextFloat(); 8 | System.out.println("Enter the side of parallelogram"); 9 | float side = in.nextFloat(); 10 | double perimeter = 2 * (base + side); 11 | System.out.println("The perimeter of parallelogram is " + perimeter); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_11.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_11 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the length of rectangle"); 7 | float length = in.nextFloat(); 8 | System.out.println("Enter the width of rectangle"); 9 | float width = in.nextFloat(); 10 | double perimeter = 2 * (length + width); 11 | System.out.println("The perimeter of rectangle is " + perimeter); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_16.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_16 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the radius of cylinder"); 7 | float radius = in.nextFloat(); 8 | System.out.println("Enter the height of cylinder"); 9 | float height = in.nextFloat(); 10 | double volume = (3.14 * radius * radius * height); 11 | System.out.println("The volume of cylinder is " + volume); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/Shadowing.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class Shadowing { 4 | static int x = 90; // this will be shadowed at line 8 5 | public static void main(String[] args) { 6 | System.out.println(x); // 90 7 | int x; // the class variable at line 4 is shadowed by this 8 | // System.out.println(x); // scope will begin when value is initialised 9 | x = 40; 10 | System.out.println(x); // 40 11 | fun(); 12 | } 13 | 14 | static void fun() { 15 | System.out.println(x); 16 | } 17 | } 18 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_19.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_19 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the radius of cylinder"); 7 | float radius = in.nextFloat(); 8 | System.out.println("Enter the height of cylinder"); 9 | float height = in.nextFloat(); 10 | double csa = (2 * 3.14 * radius * height); 11 | System.out.println("The curved surface area of cylinder is " + csa); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_4.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_4 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the base of the isosceles traingle"); 7 | float base = in.nextFloat(); 8 | System.out.println("Enter the height of the isosceles traingle"); 9 | float height = in.nextFloat(); 10 | float area = (base * height) / 2; 11 | System.out.println("The area of isosceles traingle is " + area); 12 | } 13 | } -------------------------------------------------------------------------------- /Lectures/05-first-java-program/Codes/Basics.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class Basics { 4 | public static void main(String[] args) { 5 | // int a = 10; 6 | // if (a == 10) { 7 | // System.out.println("Hello World"); 8 | // } 9 | // int count = 1; 10 | // while(count != 5) { 11 | // System.out.println(count); 12 | // count++; 13 | // } 14 | 15 | // for loop 16 | for(int count = 1; count != 5; count++) { 17 | System.out.println(count); 18 | } 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_21.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_21 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the number"); 7 | int num = in.nextInt(); 8 | int f1 = 0, f2 = 1; 9 | System.out.print(f1 + " " + f2); 10 | 11 | for (int i=2; i<=num; i++) { 12 | int f3 = f1+f2; 13 | System.out.print(" " + f3); 14 | f1 = f2; 15 | f2 = f3; 16 | } 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_6.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_6 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the length of daigonal1 of rhombus"); 7 | float daigonal1 = in.nextFloat(); 8 | System.out.println("Enter the length of daigonal1 of rhombus"); 9 | float daigonal2 = in.nextFloat(); 10 | float area = (daigonal1 * daigonal2) / 2; 11 | System.out.println("The area of rhombus is " + area); 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_17.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_17 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | 7 | String str, rev = ""; 8 | System.out.println("Enter the string : "); 9 | 10 | str = in.nextLine(); 11 | int len = str.length(); 12 | 13 | for (int i=len-1; i>=0; i--) { 14 | rev = rev + str.charAt(i); 15 | } 16 | System.out.println("The reverse of given string is " + rev); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_4.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_4 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Enter first number : "); 7 | int num1 = sc.nextInt(); 8 | 9 | System.out.print("Enter second number : "); 10 | int num2 = sc.nextInt(); 11 | 12 | int Sum = sum(num1, num2); 13 | System.out.println("The sum of given two numbers are " + Sum); 14 | } 15 | 16 | public static int sum(int a, int b) { 17 | return a+b; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_24.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Q_24 { 4 | public static void main(String arg[]) { 5 | Scanner in = new Scanner(System.in); 6 | int sum = 0; 7 | while(true) { 8 | System.out.print("Enter the number : "); 9 | int num = in.nextInt(); 10 | if (num==0) { 11 | break; 12 | } 13 | else { 14 | sum += num; 15 | } 16 | } 17 | System.out.println("The sum of all numbers are " + sum); 18 | } 19 | } -------------------------------------------------------------------------------- /Lectures/05-first-java-program/Codes/Inputs.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Inputs { 6 | public static void main(String[] args) { 7 | Scanner input = new Scanner(System.in); 8 | // System.out.print("Please enter some input: "); 9 | // int rollno = input.nextInt(); 10 | // System.out.println("Your roll number is " + rollno); 11 | 12 | // String name = input.next(); 13 | // System.out.println(name); 14 | 15 | // float marks = input.nextFloat(); 16 | // System.out.println(marks); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_5.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_5 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Enter first number : "); 7 | int num1 = sc.nextInt(); 8 | 9 | System.out.print("Enter second number : "); 10 | int num2 = sc.nextInt(); 11 | 12 | int Product = prod(num1, num2); 13 | System.out.println("The product of two given numbers are " + Product); 14 | } 15 | 16 | public static int prod(int a, int b) { 17 | return a*b; 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Assignments/02-first-java/Q_7.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_7 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | 7 | System.out.println("Enter the number : "); 8 | int num = in.nextInt(); 9 | 10 | int f1 = 0; 11 | int f2 = 1; 12 | int f3, i; 13 | 14 | System.out.print(f1 + " " + f2); 15 | 16 | for (i=2; i largest) { 11 | largest = num; 12 | } 13 | else if (num==0) { 14 | break; 15 | } 16 | } 17 | System.out.println("The largest number is " + largest); 18 | } 19 | } -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_3.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_3 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | 7 | System.out.print("Enter the number : "); 8 | int num = in.nextInt(); 9 | 10 | int sum = 0; 11 | double avg; 12 | 13 | for (int i=1; i<=num; i++) { 14 | int n = in.nextInt(); 15 | sum += n; 16 | } 17 | avg = sum / num; 18 | System.out.println("The average of " + num + " numbers are " + avg); 19 | } 20 | } 21 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_23.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_23 { 4 | public static void main(String[] args) { 5 | int i, Number, Sum = 0 ; 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Please Enter any Number: "); 8 | Number = in.nextInt(); 9 | 10 | for(i = 1 ; i < Number ; i++) { 11 | if(Number % i == 0) { 12 | Sum = Sum + i; 13 | } 14 | } 15 | if (Sum == Number) { 16 | System.out.format("% d is a Perfect Number", Number); 17 | } 18 | else { 19 | System.out.format("% d is NOT a Perfect Number", Number); 20 | } 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_7.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_7 { 4 | public static void main(String[] args){ 5 | Scanner in = new Scanner(System.in); 6 | 7 | System.out.print("Enter a number: "); 8 | int n = in.nextInt(); 9 | 10 | System.out.print("Enter a power: "); 11 | int p = in.nextInt(); 12 | 13 | System.out.print(n+" to the power of "+p+" is = "); 14 | int power = 1; 15 | 16 | while(p!=0){ 17 | power *= n; 18 | p--; 19 | } 20 | System.out.print(power); 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /Assignments/02-first-java/Q_5.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_5 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | 7 | int num1, num2; 8 | System.out.println("Enter the first number : "); 9 | num1 = in.nextInt(); 10 | 11 | System.out.println("Enter the second number : "); 12 | num2 = in.nextInt(); 13 | 14 | if (num1 > num2) { 15 | System.out.println(num1 + " is the largest number"); 16 | } 17 | else { 18 | System.out.println(num2 + " is the largest number"); 19 | } 20 | } 21 | } -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/Q_18.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_18 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the length of pyramid"); 7 | float length = in.nextFloat(); 8 | System.out.println("Enter the width of pyramid"); 9 | float width = in.nextFloat(); 10 | System.out.println("Enter the height of pyramid"); 11 | float height = in.nextFloat(); 12 | double volume = (length * width * height) / 3; 13 | System.out.println("The volume of pyramid is " + volume); 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_9.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_9 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Please enter a number : "); 7 | int num = sc.nextInt(); 8 | int factorial = fact(num); 9 | System.out.println("The factorial of given number is " + factorial); 10 | } 11 | public static int fact(int num) { 12 | int product = 1; 13 | if (num==0 || num==1) { 14 | return 1; 15 | } 16 | for (int i=1; i<=num; i++) { 17 | product *= i; 18 | } 19 | return product; 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_19.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Q_19 { 4 | public static void main(String[] args) { 5 | Scanner input = new Scanner(System.in); 6 | double p,r,t; 7 | System.out.print("Enter Principal amount : "); 8 | p = input.nextDouble(); 9 | 10 | System.out.print("Enter Rate of Interest : "); 11 | r = input.nextDouble(); 12 | 13 | System.out.print("Enter Time period in years : "); 14 | t = input.nextDouble(); 15 | 16 | double res = p+((p*r*t)/100); 17 | System.out.println("Future Investment value : "+res); 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/VarArgs.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Arrays; 4 | 5 | public class VarArgs { 6 | public static void main(String[] args) { 7 | // fun(); 8 | // multiple(2, 3, "Kunal", "Rahul", "dvytsbhusc"); 9 | // demo(); 10 | } 11 | 12 | static void demo(int ...v) { 13 | System.out.println(Arrays.toString(v)); 14 | } 15 | 16 | static void demo(String ...v) { 17 | System.out.println(Arrays.toString(v)); 18 | } 19 | 20 | static void multiple(int a, int b, String ...v) { 21 | 22 | } 23 | 24 | static void fun(int ...v) { 25 | System.out.println(Arrays.toString(v)); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assignments/02-first-java/Q_8.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_8 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | 7 | String str, rev = ""; 8 | System.out.println("Enter the string : "); 9 | 10 | str = in.nextLine(); 11 | int len = str.length(); 12 | 13 | for (int i=len-1; i>=0; i--) { 14 | rev = rev + str.charAt(i); 15 | } 16 | if (str.equals(rev)) { 17 | System.out.println("The given string is Palindrome"); 18 | } 19 | else { 20 | System.out.println("The given string is not a Palindrome"); 21 | } 22 | } 23 | } -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_1.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_1 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | 7 | System.out.print("Enter the number : "); 8 | int num = in.nextInt(); 9 | 10 | int factorial = 1; 11 | 12 | if (num==1 || num==0) { 13 | System.out.print("The factorial of " + num + " is 1"); 14 | } 15 | else { 16 | for (int i=1; i<= num; i++) { 17 | factorial *= i; 18 | } 19 | System.out.println("The factorial of " + num + " is " + factorial); 20 | } 21 | } 22 | } -------------------------------------------------------------------------------- /Assignments/04-functions/Q_2.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_2 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Enter a number : "); 7 | int num = sc.nextInt(); 8 | 9 | if (isEven(num)) { 10 | System.out.println("The given number is an Even Number"); 11 | } 12 | else { 13 | System.out.println("The given number is an Odd Number"); 14 | } 15 | 16 | } 17 | 18 | public static Boolean isEven(int num) { 19 | if (num % 2 == 0) { 20 | return true; 21 | } 22 | else { 23 | return false; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_3.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_3 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Enter your age : "); 7 | int num = sc.nextInt(); 8 | 9 | if (isEligible(num)) { 10 | System.out.println("You are eligible for vote!"); 11 | } 12 | else { 13 | System.out.println("Sorry, you're not eligible for vote!"); 14 | } 15 | 16 | } 17 | 18 | public static Boolean isEligible(int age) { 19 | if (age >= 18) { 20 | return true; 21 | } 22 | else { 23 | return false; 24 | } 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_16.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_16 { 4 | static int fact(int num) 5 | { 6 | int f=1; 7 | for (int i=1;i<=num ;i++ ) 8 | { 9 | f*=i; 10 | } 11 | return f; 12 | } 13 | public static void main(String[] args) 14 | { 15 | Scanner in = new Scanner(System.in); 16 | System.out.print("Enter value of n: "); 17 | int n = in.nextInt(); 18 | 19 | System.out.print("Enter value of r: "); 20 | int r = in.nextInt(); 21 | 22 | if(n>=r) 23 | { 24 | System.out.println(n+"c"+r+": "+ fact(n)/(fact(n-r)*fact(r))); 25 | System.out.println(n+"p"+r+": "+ fact(n)/(fact(n-r))); 26 | } 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Code/MultiAL.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.ArrayList; 4 | import java.util.Scanner; 5 | 6 | public class MultiAL { 7 | public static void main(String[] args) { 8 | Scanner in = new Scanner(System.in); 9 | ArrayList> list = new ArrayList<>(); 10 | 11 | // initialisation 12 | for (int i = 0; i < 3; i++) { 13 | list.add(new ArrayList<>()); 14 | } 15 | 16 | // add elements 17 | for (int i = 0; i < 3; i++) { 18 | for (int j = 0; j < 3; j++) { 19 | list.get(i).add(in.nextInt()); 20 | } 21 | } 22 | 23 | System.out.println(list); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Assignments/02-first-java/Q_3.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_3 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the following terms for calculating : "); 7 | 8 | System.out.println("Enter the Principal Amount : "); 9 | int P = in.nextInt(); 10 | 11 | System.out.println("Enter the Rate : "); 12 | float R = in.nextFloat(); 13 | 14 | System.out.println("Enter the Time : "); 15 | int T = in.nextInt(); 16 | 17 | float simpleInterest = (P * R * T) / 100; 18 | System.out.println("The calculated Simple Interest is " + simpleInterest); 19 | 20 | } 21 | } -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/Overloading.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class Overloading { 4 | public static void main(String[] args) { 5 | // fun(67); 6 | // fun("Kunal Kushwaha"); 7 | int ans = sum(3, 4, 78); 8 | System.out.println(ans); 9 | } 10 | 11 | static int sum(int a, int b) { 12 | return a + b; 13 | } 14 | 15 | static int sum(int a, int b, int c) { 16 | return a + b + c; 17 | } 18 | 19 | static void fun(int a) { 20 | System.out.println("first one"); 21 | System.out.println(a); 22 | } 23 | 24 | static void fun(String name) { 25 | System.out.println("Second one"); 26 | System.out.println(name); 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_18.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_18 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | 7 | int num, number, rev = 0; 8 | System.out.print("Enter the number : "); 9 | num = in.nextInt(); 10 | number = num; 11 | while (num != 0) { 12 | rev = num%10 + rev * 10; 13 | num /= 10; 14 | } 15 | if (number == rev) { 16 | System.out.println("The given number is palindrome"); 17 | } 18 | else { 19 | System.out.println("The given nmber is not palindrome");; 20 | } 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_9.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | class Q_9 { 4 | public static void main(String[] args){ 5 | Scanner input = new Scanner(System.in); 6 | 7 | System.out.print("Enter the number of Runs: "); 8 | int runs = input.nextInt(); 9 | 10 | System.out.print("Enter number of matches: "); 11 | int matches = input.nextInt(); 12 | 13 | System.out.print("Enter number of not-out matches: "); 14 | int notout = input.nextInt(); 15 | 16 | int outmatches = matches - notout; 17 | 18 | double batting_avg = runs / outmatches; 19 | 20 | System.out.println("Batting Average = "+batting_avg); 21 | 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_6.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_6 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Enter the radius of a circle : "); 7 | float num = sc.nextInt(); 8 | 9 | double Area = area(num); 10 | double Circumference = circumference(num); 11 | 12 | System.out.println("The area of the circle is " + Area); 13 | System.out.println("The circumference of the circle is " + Circumference); 14 | 15 | } 16 | 17 | public static double area(float r) { 18 | return 3.14 * r * r; 19 | } 20 | 21 | public static double circumference(float r) { 22 | return 2 * 3.14 * r; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /CONTRIBUTION.md: -------------------------------------------------------------------------------- 1 | # Contribution Guide 2 | 3 | 1. Fork the Repository by clicking on the symbol at the top right corner. 4 | 5 | 2. Clone the forked Repository in your local System. 6 | 7 | 8 | ```git clone https://github.com/your_user_name/Java-DSA-Bootcamp.git``` 9 | 10 | 11 | 3. Create a new Branch: 12 | 13 | 14 | ```git branch -YourBranchName-``` 15 | 16 | 17 | ```git checkout -YourBranchName-``` 18 | 19 | 4. Make your contributions. 20 | 21 | 5. Stage your changes and make a commit. 22 | 23 | 24 | ```git add .``` 25 | 26 | 27 | ```git commit -m ""``` 28 | 29 | 30 | 6. Push your local commits to the remote Repository. 31 | 32 | 33 | ```git push origin -YourBranchName-``` 34 | 35 | 7. Create a PR. 36 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Code/Swap.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | 3 | public class Swap { 4 | public static void main(String[] args) { 5 | int[] arr = {1, 3, 23, 9, 18, 56}; 6 | // swap(arr, 0, 4); 7 | reverse(arr); 8 | System.out.println(Arrays.toString(arr)); 9 | } 10 | 11 | static void reverse(int[] arr) { 12 | int start = 0; 13 | int end = arr.length-1; 14 | 15 | while (start < end) { 16 | // swap 17 | swap(arr, start, end); 18 | start++; 19 | end--; 20 | } 21 | } 22 | static void swap(int[] arr, int index1, int index2) { 23 | int temp = arr[index1]; 24 | arr[index1] = arr[index2]; 25 | arr[index2] = temp; 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/StringExample.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class StringExample { 6 | 7 | public static void main(String[] args) { 8 | // String message = greet(); 9 | // System.out.println(message); 10 | 11 | Scanner in = new Scanner(System.in); 12 | System.out.print("Enter your name: "); 13 | String naam = in.next(); 14 | String personalised = myGreet(naam); 15 | System.out.println(personalised); 16 | } 17 | 18 | static String myGreet(String name) { 19 | String message = "Hello " + name; 20 | return message; 21 | } 22 | 23 | 24 | static String greet() { 25 | String greeting = "how are you"; 26 | return greeting; 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Assignments/02-first-java/README.md: -------------------------------------------------------------------------------- 1 | # [First Java Program](https://youtu.be/TAtrPoaJ7gc) 2 | 3 | ## Write Java programs for the following: 4 | 5 | 1. Write a program to print whether a number is even or odd, also take 6 | input. 7 | 2. Take name as input and print a greeting message for that name. 8 | 3. Write a program to input principal, time, and rate (P, T, R) from the user and 9 | find Simple Interest. 10 | 4. Take in two numbers and an operator (+, -, *, /) and calculate the value. 11 | (Use if conditions) 12 | 5. Take 2 numbers as input and print the largest number. 13 | 6. Input currency in rupees and output in USD. 14 | 7. To calculate Fibonacci Series up to n numbers. 15 | 8. To find out whether the given String is Palindrome or not. 16 | 9. To find Armstrong Number between two given number. 17 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_12.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_12 { 4 | public static void main(String arg[]) { 5 | Scanner in = new Scanner(System.in); 6 | int sum = 0; 7 | int count = 0; 8 | System.out.println("After fillings the marks press 0"); 9 | while(true) { 10 | System.out.print("Enter the marks : "); 11 | double marks = in.nextDouble(); 12 | if (marks==0) { 13 | break; 14 | } 15 | else { 16 | sum += marks; 17 | count += 1; 18 | } 19 | } 20 | double avg = sum/count; 21 | System.out.println("The average of all the marks are : " + avg); 22 | } 23 | } 24 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_8.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_8 { 4 | public static void main(String[] args){ 5 | long amount,deppercent,year,temp; 6 | Scanner in = new Scanner(System.in); 7 | System.out.print("Enter amount : "); 8 | amount = in.nextLong(); 9 | 10 | System.out.print("Enter Depreciation percentage : "); 11 | deppercent = in.nextLong(); 12 | 13 | System.out.print("Enter number of years : "); 14 | year = in.nextLong(); 15 | 16 | temp = amount; 17 | 18 | for(int i=0; i n) { 24 | System.out.println("Prime"); 25 | } 26 | 27 | } 28 | } 29 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_4.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_4 { 4 | public static void main(String[] args){ 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter The Price Of Product"); 7 | double price = in.nextDouble(); 8 | 9 | double discount = 0; 10 | 11 | if(price>1000){ 12 | discount = price*0.1; 13 | } 14 | else if(price>500){ 15 | discount = price*0.2; 16 | } 17 | else{ 18 | discount = price*0.3; 19 | } 20 | 21 | double total = price-discount; 22 | System.out.println("Total Price Of Product Is "+total); 23 | System.out.println("Discount Of Product Is "+discount); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /Assignments/02-first-java/Q_9.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_9 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | int num1, num2, n1, n2, sum=0; 7 | 8 | System.out.println("Enter the fisrt number : "); 9 | num1 = in.nextInt(); 10 | 11 | System.out.println("Enter the second number : "); 12 | num2 = in.nextInt(); 13 | 14 | for (int i=num1; i<=num2; i++) { 15 | n1 = i; 16 | while (n1>0) { 17 | n2 = n1%10; 18 | sum = sum + (n2 * n2 *n2); 19 | n1 = n1/10; 20 | } 21 | if (sum == i) { 22 | System.out.print(i + " "); 23 | } 24 | sum=0; 25 | } 26 | } 27 | } -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/Swap.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class Swap { 4 | public static void main(String[] args) { 5 | int a = 10; 6 | int b = 20; 7 | 8 | // swap numbers code 9 | // int temp = a; 10 | // a = b; 11 | // b = temp; 12 | 13 | swap(a, b); 14 | 15 | System.out.println(a + " " + b); 16 | 17 | String name = "Kunal Kushwaha"; 18 | changeName(name); 19 | System.out.println(name); 20 | } 21 | 22 | static void changeName(String naam) { 23 | naam = "Rahul Rana"; // creating a new object 24 | } 25 | 26 | static void swap(int num1, int num2) { 27 | int temp = num1; 28 | num1 = num2; 29 | num2 = temp; 30 | // this change will only be valid in this function scope only. 31 | } 32 | } 33 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_11.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_11 { 4 | public static void main(String[] args){ 5 | Scanner in = new Scanner(System.in); 6 | float p, r, n, t; 7 | System.out.print("Enter the initial principal balance (P) : "); 8 | p = in.nextFloat(); 9 | 10 | System.out.print("Enter the interest rate (R) : "); 11 | r = in.nextFloat(); 12 | 13 | System.out.print("number of times interest applied per time period (n) : "); 14 | n = in.nextFloat(); 15 | 16 | System.out.print("Enter the number of time periods elapsed (t) : "); 17 | t = in.nextFloat(); 18 | 19 | double A = (p * Math.pow((1 + (r/n)), (n*t))); 20 | 21 | System.out.println("The final amount is " + A); 22 | } 23 | } -------------------------------------------------------------------------------- /Assignments/04-functions/Q_7.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_7 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Enter a number : "); 7 | int num = sc.nextInt(); 8 | 9 | if (isPrime(num)) { 10 | System.out.println("The given number is Prime"); 11 | } 12 | else { 13 | System.out.println("The given number is not Prime"); 14 | } 15 | 16 | 17 | } 18 | 19 | public static Boolean isPrime(int num) { 20 | if (num <= 1) { 21 | return false; 22 | } 23 | else { 24 | for (int i=2; i max) { 16 | // max = b; 17 | // } 18 | // if (c > max) { 19 | // max = c; 20 | // } 21 | 22 | // int max = 0; 23 | // if (a > b) { 24 | // max = a; 25 | // } else { 26 | // max = b; 27 | // } 28 | // 29 | // if (c > max) { 30 | // max = c; 31 | // } 32 | 33 | int max = Math.max(c, Math.max(a, b)); 34 | 35 | System.out.println(max); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_2.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_2 { 4 | public static void main(String args[]) { 5 | // electricity bill program 6 | Scanner in = new Scanner(System.in); 7 | 8 | System.out.println("Enter the amount of kwh used: "); 9 | double kwh = in.nextDouble(); 10 | 11 | System.out.println("Enter the cost of the kwh: "); 12 | double cost = in.nextDouble(); 13 | 14 | System.out.println("Enter the number of days used: "); 15 | int days = in.nextInt(); 16 | 17 | double bill = 0; 18 | if(kwh > 0 && cost > 0 && days > 0){ 19 | bill = kwh * cost; 20 | bill = bill / days; 21 | System.out.println("The bill is: " + bill); 22 | } 23 | else{ 24 | System.out.println("Invalid input"); 25 | } 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_5.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_5 { 4 | public static void main(String[] args){ 5 | Scanner in = new Scanner(System.in); 6 | int x1, x2, y1, y2; 7 | System.out.println("Enter the coordinates of first point : "); 8 | 9 | System.out.print("Enter the x1 point : "); 10 | x1 = in.nextInt(); 11 | 12 | System.out.print("Enter the x2 point : "); 13 | x2 = in.nextInt(); 14 | 15 | System.out.println("Enter the coordinates of second point : "); 16 | 17 | System.out.print("Enter the y1 point : "); 18 | y1 = in.nextInt(); 19 | 20 | System.out.print("Enter the y2 point : "); 21 | y2 = in.nextInt(); 22 | 23 | double distance = Math.sqrt(((x2-x1) * (x2-x1)) + ((y2-y1) * (y2-y1))); 24 | 25 | System.out.println("The distance between two points are : " + distance); 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_13.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_13 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Enter first number : "); 7 | int num1 = sc.nextInt(); 8 | 9 | System.out.print("Enter second number : "); 10 | int num2 = sc.nextInt(); 11 | 12 | System.out.print("The prime numbers are : "); 13 | 14 | for (int i=num1; i<=num2; i++) { 15 | if (isPrime(i)) { 16 | System.out.print(i + " "); 17 | } 18 | } 19 | } 20 | 21 | public static Boolean isPrime(int num) { 22 | if (num <= 1) { 23 | return false; 24 | } 25 | else { 26 | for (int i=2; i0) { 16 | if (temp%2==0) { 17 | sum_even += temp; 18 | } 19 | else { 20 | sum_odd += temp; 21 | } 22 | } 23 | temp = input.nextInt(); 24 | } 25 | System.out.println("Sum of Negative numbers : "+sum_negative); 26 | System.out.println("Sum of Positive odd numbers : "+sum_odd); 27 | System.out.println("Sum of Positive even number : "+sum_even); 28 | } 29 | } 30 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Code/Max.java: -------------------------------------------------------------------------------- 1 | public class Max { 2 | public static void main(String[] args) { 3 | int[] arr = {1, 3, 2, 9, 18}; 4 | System.out.println(maxRange(arr, 1, 3)); 5 | } 6 | 7 | // work on edge cases here, like array being null 8 | static int maxRange(int[] arr, int start, int end) { 9 | 10 | if (start > end) { 11 | return -1; 12 | } 13 | 14 | if (arr == null) { 15 | return -1; 16 | } 17 | 18 | int maxVal = arr[start]; 19 | for (int i = start; i <= end; i++) { 20 | if (arr[i] > maxVal) { 21 | maxVal = arr[i]; 22 | } 23 | } 24 | return maxVal; 25 | } 26 | 27 | static int max(int[] arr) { 28 | if (arr.length == 0) { 29 | return -1; 30 | } 31 | int maxVal = arr[0]; 32 | for (int i = 1; i < arr.length; i++) { 33 | if (arr[i] > maxVal) { 34 | maxVal = arr[i]; 35 | } 36 | } 37 | return maxVal; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Conditionals Codes/Conditionals.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class Conditionals { 4 | 5 | public static void main(String[] args) { 6 | /* 7 | Syntax of if statements: 8 | if (boolean expression T or F) { 9 | // body 10 | } else { 11 | // do this 12 | } 13 | */ 14 | 15 | int salary = 25400; 16 | // if (salary > 10000) { 17 | // salary = salary + 2000; 18 | // } else { 19 | // salary = salary + 1000; 20 | // } 21 | 22 | // multiple if-else 23 | 24 | // if (salary > 10000) { 25 | // salary += 2000; // salary = salary + 2000 26 | // } else if (salary > 20000) { 27 | // salary += 3000; 28 | // } else { 29 | // salary += 1000; 30 | // } 31 | // 32 | // System.out.println(salary); 33 | 34 | int a = 10; 35 | int b = 40; 36 | 37 | if (a != 35) { 38 | System.out.println("Hello World"); 39 | } 40 | } 41 | } 42 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Code/ArrayListExample.java: -------------------------------------------------------------------------------- 1 | import java.util.ArrayList; 2 | import java.util.Scanner; 3 | 4 | public class ArrayListExample { 5 | public static void main(String[] args) { 6 | Scanner in = new Scanner(System.in); 7 | // Syntax 8 | ArrayList list = new ArrayList<>(5); 9 | 10 | // list.add(67); 11 | // list.add(234); 12 | // list.add(654); 13 | // list.add(43); 14 | // list.add(654); 15 | // list.add(8765); 16 | 17 | // System.out.println(list.contains(765432)); 18 | // System.out.println(list); 19 | // list.set(0, 99); 20 | // 21 | // list.remove(2); 22 | // 23 | // System.out.println(list); 24 | 25 | // input 26 | for (int i = 0; i < 5; i++) { 27 | list.add(in.nextInt()); 28 | } 29 | 30 | // get item at any index 31 | for (int i = 0; i < 5; i++) { 32 | System.out.println(list.get(i)); // pass index here, list[index] syntax will not work here 33 | } 34 | 35 | System.out.println(list); 36 | } 37 | } 38 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Code/Main.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class Main { 4 | 5 | public static void main(String[] args) { 6 | // Q: store a roll number 7 | int a = 19; 8 | 9 | // Q: store a person's name 10 | String name = "Kunal Kushwaha"; 11 | 12 | // Q: store 5 roll numbers 13 | int rno1 = 23; 14 | int rno2 = 55; 15 | int rno3 = 18; 16 | 17 | // syntax 18 | // datatype[] variable_name = new datatype[size]; 19 | // store 5 roll numbers: 20 | // int[] rnos = new int[5]; 21 | // // or directly 22 | // int[] rnos2 = {23, 12, 45, 32, 15}; 23 | 24 | int[] ros; // declaration of array. ros is getting defined in the stack 25 | ros = new int[5]; // initialisation: actually here object is being created in the memory (heap) 26 | 27 | // System.out.println(ros[1]); 28 | 29 | String[] arr = new String[4]; 30 | System.out.println(arr[0]); 31 | 32 | // for (String element : arr) { 33 | // System.out.println(element); 34 | // } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/Q_6.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | public class Q_6 { 3 | public static void main(String[] args){ 4 | Scanner in = new Scanner(System.in); 5 | System.out.print("Enter the number of sales: "); 6 | int sales = in.nextInt(); 7 | 8 | System.out.print("Enter the commission percentage: "); 9 | int comm = in.nextInt(); 10 | 11 | System.out.print("Enter the number of commission rates: "); 12 | int rates = in.nextInt(); 13 | 14 | System.out.print("Enter the commission rates: "); 15 | int[] ratesArray = new int[rates]; 16 | 17 | for(int i = 0; i < rates; i++){ 18 | ratesArray[i] = in.nextInt(); 19 | } 20 | // Calculate commission 21 | int commission = 0; 22 | 23 | for(int i = 0; i < rates; i++){ 24 | if(sales >= ratesArray[i]){ 25 | commission += (sales * comm / 100); 26 | } 27 | } 28 | System.out.println("The commission is: " + commission); 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Kishan Kumar Rai 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_8.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_8 { 4 | public static void main(String args[]) { 5 | Scanner sc = new Scanner(System.in); 6 | System.out.print("Please enter your marks : "); 7 | int num = sc.nextInt(); 8 | grades(num); 9 | } 10 | public static void grades(int num) { 11 | if (num>100) { 12 | System.out.println("Please enter valid marks."); 13 | } 14 | else if (num>90) { 15 | System.out.println("Your grade is AA"); 16 | } 17 | else if (num>80) { 18 | System.out.println("Your grade is AB"); 19 | } 20 | else if (num>70) { 21 | System.out.println("Your grade is BB"); 22 | } 23 | else if (num>60) { 24 | System.out.println("Your grade is BC"); 25 | } 26 | else if (num>50) { 27 | System.out.println("Your grade is CD"); 28 | } 29 | else if (num>40) { 30 | System.out.println("Your grade is DD"); 31 | } 32 | else if (num<=40) { 33 | System.out.println("Sorry you got Fail"); 34 | } 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Assignments/02-first-java/Q_4.java: -------------------------------------------------------------------------------- 1 | import java.util.Scanner; 2 | 3 | public class Q_4 { 4 | public static void main(String args[]) { 5 | Scanner in = new Scanner(System.in); 6 | System.out.println("Enter the choice for perform the following operations\n [+, -, *, /]"); 7 | 8 | System.out.println("Enter the first number : "); 9 | int num1 = in.nextInt(); 10 | 11 | System.out.println("Enter the second number : "); 12 | int num2 = in.nextInt(); 13 | 14 | System.out.println("Enter the operator : "); 15 | char choice = in.next().charAt(0); 16 | double result = 0; 17 | 18 | if (choice == '+') { 19 | result = num1 + num2; 20 | } 21 | else if (choice == '-') { 22 | result = num1 - num2; 23 | } 24 | else if (choice == '*') { 25 | result = num1 * num2; 26 | } 27 | else if (choice == '/') { 28 | result = num1 / num2; 29 | } 30 | else { 31 | System.out.println("Please enter valid input"); 32 | } 33 | System.out.println("The result is " + result); 34 | } 35 | } -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/Questions.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Questions { 6 | public static void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | // int n = in.nextInt(); 9 | // boolean ans = isPrime(n); 10 | // System.out.println(ans); 11 | 12 | for (int i = 100; i < 1000; i++) { 13 | if (isArmstrong(i)) { 14 | System.out.print(i + " "); 15 | } 16 | } 17 | } 18 | 19 | // print all the 3 digits armstrong numbers 20 | static boolean isArmstrong(int n) { 21 | int original = n; 22 | int sum = 0; 23 | 24 | while (n > 0) { 25 | int rem = n % 10; 26 | n = n / 10; 27 | sum = sum + rem*rem*rem; 28 | } 29 | 30 | return sum == original; 31 | } 32 | 33 | static boolean isPrime(int n) { 34 | if (n <= 1) { 35 | return false; 36 | } 37 | int c = 2; 38 | while (c * c <= n) { 39 | if (n % c == 0) { 40 | return false; 41 | } 42 | c++; 43 | } 44 | return c * c > n; 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Basic/README.md: -------------------------------------------------------------------------------- 1 | # Basic Problems 2 | 3 | ## Write Java programs for the following: 4 | 5 | ### Basic Java Programs 6 | 1. Area Of Circle Java Program 7 | 2. Area Of Triangle 8 | 3. Area Of Rectangle Program 9 | 4. Area Of Isosceles Triangle 10 | 5. Area Of Parallelogram 11 | 6. Area Of Rhombus 12 | 7. Area Of Equilateral Triangle 13 | 8. Perimeter Of Circle 14 | 9. Perimeter Of Equilateral Triangle 15 | 10. Perimeter Of Parallelogram 16 | 11. Perimeter Of Rectangle 17 | 12. Perimeter Of Square 18 | 13. Perimeter Of Rhombus 19 | 14. Volume Of Cone Java Program 20 | 15. Volume Of Prism 21 | 16. Volume Of Cylinder 22 | 17. Volume Of Sphere 23 | 18. Volume Of Pyramid 24 | 19. Curved Surface Area Of Cylinder 25 | 20. Total Surface Area Of Cube 26 | 21. Fibonacci Series In Java Programs 27 | 22. [Subtract the Product and Sum of Digits of an Integer](https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/) 28 | 23. Input a number and print all the factors of that number (use loops). 29 | 24. Take integer inputs till the user enters 0 and print the sum of all numbers 30 | (HINT: while loop) 31 | 25. Take integer inputs till the user enters 0 and print the largest number from 32 | all. 33 | -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/Scope.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | public class Scope { 4 | public static void main(String[] args) { 5 | int a = 10; 6 | int b = 20; 7 | String name = "Kunal"; 8 | { 9 | // int a = 78; // already initialised outside the block in the same method, hence you cannot initialise again 10 | a = 100; // reassign the origin ref variable to some other value 11 | System.out.println(a); 12 | int c = 99; 13 | name = "Rahul"; 14 | System.out.println(name); 15 | // values initialised in this block, will remain in block 16 | } 17 | int c = 900; 18 | System.out.println(a); 19 | System.out.println(name); 20 | // System.out.println(c); // cannot use outside the block 21 | 22 | // scoping in for loops 23 | for (int i = 0; i < 4; i++) { 24 | // System.out.println(i); 25 | int num = 90; 26 | a = 10000; 27 | } 28 | System.out.println(); 29 | } 30 | 31 | static void random(int marks) { 32 | int num = 67; 33 | System.out.println(num); 34 | System.out.println(marks); 35 | } 36 | } 37 | -------------------------------------------------------------------------------- /Lectures/05-first-java-program/Codes/TypeCasting.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class TypeCasting { 6 | public static void main(String[] args) { 7 | Scanner input = new Scanner(System.in); 8 | // float num = input.nextFloat(); 9 | // int num = input.nextInt(); 10 | // System.out.println(num); 11 | 12 | // type casting 13 | int num = (int)(67.56f); 14 | // System.out.println(num); 15 | 16 | // automatic type promotion in expressions 17 | // int a = 257; 18 | // byte b = (byte)(a); // 257 % 256 = 1 19 | 20 | // byte a = 40; 21 | // byte b = 50; 22 | // byte c = 100; 23 | // int d = a * b / c; 24 | // 25 | // System.out.println(d); 26 | 27 | // byte b = 50; 28 | // b = b * 2; 29 | 30 | // int number = 'A'; 31 | // System.out.println("你好"); 32 | 33 | // System.out.println(3 * 6); 34 | 35 | byte b = 42; 36 | char c = 'a'; 37 | short s = 1024; 38 | int i = 50000; 39 | float f = 5.67f; 40 | double d = 0.1234; 41 | double result = (f * b) + (i / c) - (d * s); 42 | // float + int - double = double 43 | System.out.println((f * b) + " " + (i / c) + " " + (d * s)); 44 | System.out.println(result); 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/Sum.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Sum { 6 | public static void main(String[] args) { 7 | // int ans = sum2(); 8 | // System.out.println(ans); 9 | 10 | int ans = sum3(20, 30); 11 | System.out.println(ans); 12 | } 13 | 14 | // pass the value of numbers when you are calling the method in main() 15 | static int sum3(int a, int b) { 16 | int sum = a + b; 17 | return sum; 18 | } 19 | 20 | // return the value 21 | static int sum2() { 22 | Scanner in = new Scanner(System.in); 23 | System.out.print("Enter number 1: "); 24 | int num1 = in.nextInt(); 25 | System.out.print("Enter number 2: "); 26 | int num2 = in.nextInt(); 27 | int sum = num1 + num2; 28 | return sum; 29 | // System.out.println("This will never execute"); 30 | } 31 | 32 | static void sum() { 33 | Scanner in = new Scanner(System.in); 34 | System.out.print("Enter number 1: "); 35 | int num1 = in.nextInt(); 36 | System.out.print("Enter number 2: "); 37 | int num2 = in.nextInt(); 38 | int sum = num1 + num2; 39 | System.out.println("The sum = " + sum); 40 | } 41 | 42 | /* 43 | return_type name (arguments) { 44 | // body 45 | return statement; 46 | } 47 | 48 | */ 49 | } 50 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/Intermediate/README.md: -------------------------------------------------------------------------------- 1 | # [Conditionals & Loops Video Link](https://youtu.be/ldYLYRNaucM) 2 | 3 | ## Write Java programs for the following: 4 | 5 | ### Intermediate Java Programs 6 | 1. Factorial Program In Java 7 | 2. Calculate Electricity Bill 8 | 3. Calculate Average Of N Numbers 9 | 4. Calculate Discount Of Product 10 | 5. Calculate Distance Between Two Points 11 | 6. Calculate Commission Percentage 12 | 7. Power In Java 13 | 8. Calculate Depreciation of Value 14 | 9. Calculate Batting Average 15 | 10. Calculate CGPA Java Program 16 | 11. Compound Interest Java Program 17 | 12. Calculate Average Marks 18 | 13. Addition Of Two Numbers 19 | 14. Sum Of N Numbers 20 | 15. Armstrong Number In Java 21 | 16. Find Ncr & Npr 22 | 17. Reverse A String In Java 23 | 18. Find if a number is palindrome or not 24 | 19. Future Investment Value 25 | 20. HCF Of Two Numbers Program 26 | 21. LCM Of Two Numbers 27 | 22. Java Program Vowel Or Consonant 28 | 23. Perfect Number In Java 29 | 24. Check Leap Year Or Not 30 | 25. Sum Of A Digits Of Number 31 | 26. Kunal is allowed to go out with his friends only on the even days of a given month. Write a program to count the number of days he can go out in the month of August. 32 | 27. Write a program to print the sum of negative numbers, sum of positive even numbers and the sum of positive odd numbers from a list of numbers (N) entered by the user. The list terminates when the user enters a zero. 33 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Code/Input.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.Scanner; 3 | 4 | public class Input { 5 | public static void main(String[] args) { 6 | Scanner in = new Scanner(System.in); 7 | 8 | // array of primitives 9 | int[] arr = new int[5]; 10 | arr[0] = 23; 11 | arr[1] = 45; 12 | arr[2] = 233; 13 | arr[3] = 543; 14 | arr[4] = 3; 15 | // [23, 45, 233, 543, 3] 16 | System.out.println(arr[3]); 17 | 18 | // input using for loops 19 | for (int i = 0; i < arr.length; i++) { 20 | arr[i] = in.nextInt(); 21 | } 22 | // 23 | // System.out.println(Arrays.toString(arr)); 24 | 25 | // for (int i = 0; i < arr.length; i++) { 26 | // System.out.print(arr[i] + " "); 27 | // } 28 | 29 | // for(int num : arr) { // for every element in array, print the element 30 | // System.out.print(num + " "); // here num represents element of the array 31 | // } 32 | 33 | // System.out.println(arr[5]); // index out of bound error 34 | 35 | // array of objects 36 | String[] str = new String[4]; 37 | for (int i = 0; i < str.length; i++) { 38 | str[i] = in.next(); 39 | } 40 | 41 | System.out.println(Arrays.toString(str)); 42 | 43 | // modify 44 | str[1] = "kunal"; 45 | 46 | System.out.println(Arrays.toString(str)); 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Conditionals Codes/Loops.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Loops { 6 | public static void main(String[] args) { 7 | 8 | /* 9 | Syntax of for loops: 10 | 11 | for (initialisation; condition; increment/decrement) { 12 | // body 13 | } 14 | */ 15 | 16 | // Q: Print numbers from 1 to 5 17 | // for (int num = 1; num <= 5; num += 2) { 18 | // System.out.println(num); 19 | // } 20 | 21 | // print numbers from 1 to n 22 | Scanner in = new Scanner(System.in); 23 | // int n = in.nextInt(); 24 | 25 | // for (int num = 1; num <= n; num++) { 26 | //// System.out.print(num + " "); 27 | // System.out.println("Hello World"); 28 | // } 29 | 30 | // while loops 31 | /* 32 | Syntax: 33 | while (condition) { 34 | // body 35 | } 36 | */ 37 | 38 | // for (int num = 1; num <= 5; num += 2) { 39 | // System.out.println(num); 40 | // } 41 | 42 | int num = 1; 43 | while (num <= 5) { 44 | // System.out.println(num); 45 | num += 1; 46 | } 47 | 48 | // do while 49 | /* 50 | 51 | do { 52 | // body 53 | } while (condition); 54 | 55 | */ 56 | int n = 1; 57 | do { 58 | System.out.println("Hello World"); 59 | } while (n != 1); 60 | 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /Lectures/08-arrays/Code/MultiDimension.java: -------------------------------------------------------------------------------- 1 | import java.util.Arrays; 2 | import java.util.Scanner; 3 | 4 | public class MultiDimension { 5 | public static void main(String[] args) { 6 | /* 7 | 1 2 3 8 | 4 5 6 9 | 7 8 9 10 | */ 11 | Scanner in = new Scanner(System.in); 12 | // int[][] arr = new int[3][]; 13 | 14 | // int[][] arr = { 15 | // {1, 2, 3}, // 0th index 16 | // {4, 5}, // 1st index 17 | // {6, 7, 8, 9} // 2nd index -> arr[2] = {6, 7, 8, 9} 18 | // }; 19 | 20 | int[][] arr = new int[3][3]; 21 | System.out.println(arr.length); // no of rows 22 | // input 23 | 24 | for (int row = 0; row < arr.length; row++) { 25 | // for each col in every row 26 | for (int col = 0; col < arr[row].length; col++) { 27 | arr[row][col] = in.nextInt(); 28 | } 29 | } 30 | 31 | // output 32 | // for (int row = 0; row < arr.length; row++) { 33 | // // for each col in every row 34 | // for (int col = 0; col < arr[row].length; col++) { 35 | // System.out.print(arr[row][col] + " "); 36 | // } 37 | // System.out.println(); 38 | // } 39 | 40 | // output 41 | // for (int row = 0; row < arr.length; row++) { 42 | // System.out.println(Arrays.toString(arr[row])); 43 | // } 44 | 45 | for(int[] a : arr) { 46 | System.out.println(Arrays.toString(a)); 47 | } 48 | } 49 | } 50 | -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Conditionals Codes/Calculator.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Calculator { 6 | public static void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | // Take input from user till user does not press X or x 9 | int ans = 0; 10 | while (true) { 11 | // take the operator as input 12 | System.out.print("Enter the operator: "); 13 | char op = in.next().trim().charAt(0); 14 | 15 | if (op == '+' || op == '-' || op == '*' || op == '/' || op == '%') { 16 | // input two numbers 17 | System.out.print("Enter two numbers: "); 18 | int num1 = in.nextInt(); 19 | int num2 = in.nextInt(); 20 | 21 | if (op == '+') { 22 | ans = num1 + num2; 23 | } 24 | if (op == '-') { 25 | ans = num1 - num2; 26 | } 27 | if (op == '*') { 28 | ans = num1 * num2; 29 | } 30 | if (op == '/') { 31 | if (num2 != 0) { 32 | ans = num1 / num2; 33 | } 34 | } 35 | if (op == '%') { 36 | ans = num1 % num2; 37 | } 38 | } else if (op == 'x' || op == 'X') { 39 | break; 40 | } else { 41 | System.out.println("Invalid operation!!"); 42 | } 43 | System.out.println(ans); 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /Assignments/04-functions/Q_1.java: -------------------------------------------------------------------------------- 1 | import java.util.*; 2 | 3 | public class Q_1 { 4 | public static void main(String args[]) { 5 | System.out.println("Please enter 3 numbers to find greatest among them"); 6 | Scanner sc = new Scanner(System.in); 7 | System.out.print("Enter first number : "); 8 | int a = sc.nextInt(); 9 | 10 | System.out.print("Enter second number : "); 11 | int b = sc.nextInt(); 12 | 13 | System.out.print("Enter third number : "); 14 | int c = sc.nextInt(); 15 | 16 | int large = largest(a, b, c); 17 | System.out.println("The greatest among three numbers is : " + large); 18 | 19 | int small = smallest(a, b, c); 20 | System.out.println("The smallest among three numbers is : " + small); 21 | } 22 | 23 | public static int largest(int a, int b, int c) { 24 | if (a>b) { 25 | if (a>c) { 26 | return a; 27 | } 28 | else{ 29 | return c; 30 | } 31 | } 32 | else { 33 | if (b>c) { 34 | return b; 35 | } 36 | else { 37 | return c; 38 | } 39 | } 40 | } 41 | 42 | public static int smallest(int a, int b, int c) { 43 | if (a System.out.println("King of fruits"); 13 | // case "Apple" -> System.out.println("A sweet red fruit"); 14 | // case "Orange" -> System.out.println("Round fruit"); 15 | // case "Grapes" -> System.out.println("Small fruit"); 16 | // default -> System.out.println("please enter a valid fruit"); 17 | // } 18 | 19 | int day = in.nextInt(); 20 | // switch (day) { 21 | // case 1 -> System.out.println("Monday"); 22 | // case 2 -> System.out.println("Tuesday"); 23 | // case 3 -> System.out.println("Wednesday"); 24 | // case 4 -> System.out.println("Thursday"); 25 | // case 5 -> System.out.println("Friday"); 26 | // case 6 -> System.out.println("Saturday"); 27 | // case 7 -> System.out.println("Sunday"); 28 | // } 29 | 30 | // switch (day) { 31 | // case 1: 32 | // case 2: 33 | // case 3: 34 | // case 4: 35 | // case 5: 36 | // System.out.println("Weekday"); 37 | // break; 38 | // case 6: 39 | // case 7: 40 | // System.out.println("Weekend"); 41 | // break; 42 | // } 43 | 44 | switch (day) { 45 | case 1, 2, 3, 4, 5 -> System.out.println("Weekday"); 46 | case 6, 7 -> System.out.println("Weekend"); 47 | } 48 | 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Lectures/06-conditions-loops/Switch Codes/NestedSwitch.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class NestedSwitch { 6 | public static void main(String[] args) { 7 | Scanner in = new Scanner(System.in); 8 | int empID = in.nextInt(); 9 | String department = in.next(); 10 | 11 | switch (empID) { 12 | case 1: 13 | System.out.println("Kunal Kushwaha"); 14 | break; 15 | case 2: 16 | System.out.println("Rahul Rana"); 17 | break; 18 | case 3: 19 | System.out.println("Emp Number 3"); 20 | switch (department) { 21 | case "IT": 22 | System.out.println("IT Department"); 23 | break; 24 | case "Management": 25 | System.out.println("Management Department"); 26 | break; 27 | default: 28 | System.out.println("No department entered"); 29 | } 30 | break; 31 | default: 32 | System.out.println("Enter correct EmpID"); 33 | } 34 | 35 | // better way to write 36 | switch (empID) { 37 | case 1 -> System.out.println("Kunal Kushwaha"); 38 | case 2 -> System.out.println("Rahul Rana"); 39 | case 3 -> { 40 | System.out.println("Emp Number 3"); 41 | switch (department) { 42 | case "IT" -> System.out.println("IT Department"); 43 | case "Management" -> System.out.println("Management Department"); 44 | default -> System.out.println("No department entered"); 45 | } 46 | } 47 | default -> System.out.println("Enter correct EmpID"); 48 | } 49 | } 50 | } 51 | -------------------------------------------------------------------------------- /Assignments/03-conditionals-loops/README.md: -------------------------------------------------------------------------------- 1 | # [Conditionals & Loops Video Link](https://youtu.be/ldYLYRNaucM) 2 | 3 | ## Write Java programs for the following: 4 | 5 | ### Basic Java Programs 6 | 1. Area Of Circle Java Program 7 | 2. Area Of Triangle 8 | 3. Area Of Rectangle Program 9 | 4. Area Of Isosceles Triangle 10 | 5. Area Of Parallelogram 11 | 6. Area Of Rhombus 12 | 7. Area Of Equilateral Triangle 13 | 8. Perimeter Of Circle 14 | 9. Perimeter Of Equilateral Triangle 15 | 10. Perimeter Of Parallelogram 16 | 11. Perimeter Of Rectangle 17 | 12. Perimeter Of Square 18 | 13. Perimeter Of Rhombus 19 | 14. Volume Of Cone Java Program 20 | 15. Volume Of Prism 21 | 16. Volume Of Cylinder 22 | 17. Volume Of Sphere 23 | 18. Volume Of Pyramid 24 | 19. Curved Surface Area Of Cylinder 25 | 20. Total Surface Area Of Cube 26 | 21. Fibonacci Series In Java Programs 27 | 22. [Subtract the Product and Sum of Digits of an Integer](https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer/) 28 | 23. Input a number and print all the factors of that number (use loops). 29 | 24. Take integer inputs till the user enters 0 and print the sum of all numbers 30 | (HINT: while loop) 31 | 25. Take integer inputs till the user enters 0 and print the largest number from 32 | all. 33 | 34 | ### Intermediate Java Programs 35 | 1. Factorial Program In Java 36 | 2. Calculate Electricity Bill 37 | 3. Calculate Average Of N Numbers 38 | 4. Calculate Discount Of Product 39 | 5. Calculate Distance Between Two Points 40 | 6. Calculate Commission Percentage 41 | 7. Power In Java 42 | 8. Calculate Depreciation of Value 43 | 9. Calculate Batting Average 44 | 10. Calculate CGPA Java Program 45 | 11. Compound Interest Java Program 46 | 12. Calculate Average Marks 47 | 13. Addition Of Two Numbers 48 | 14. Sum Of N Numbers 49 | 15. Armstrong Number In Java 50 | 16. Find Ncr & Npr 51 | 17. Reverse A String In Java 52 | 18. Find if a number is palindrome or not 53 | 19. Future Investment Value 54 | 20. HCF Of Two Numbers Program 55 | 21. LCM Of Two Numbers 56 | 22. Java Program Vowel Or Consonant 57 | 23. Perfect Number In Java 58 | 24. Check Leap Year Or Not 59 | 25. Sum Of A Digits Of Number 60 | 26. Kunal is allowed to go out with his friends only on the even days of a given month. Write a program to count the number of days he can go out in the month of August. 61 | 27. Write a program to print the sum of negative numbers, sum of positive even numbers and the sum of positive odd numbers from a list of numbers (N) entered by the user. The list terminates when the user enters a zero. 62 | -------------------------------------------------------------------------------- /Lectures/07-methods/Codes/Main.java: -------------------------------------------------------------------------------- 1 | package com.kunal; 2 | 3 | import java.util.Scanner; 4 | 5 | public class Main { 6 | 7 | public static void main(String[] args) { 8 | // Q: take input of 2 numbers and print the sum 9 | Scanner in = new Scanner(System.in); 10 | int num1, num2, sum; 11 | 12 | System.out.print("Enter number 1: "); 13 | num1 = in.nextInt(); 14 | System.out.print("Enter number 2: "); 15 | num2 = in.nextInt(); 16 | sum = num1 + num2; 17 | System.out.println("The sum = " + sum); 18 | 19 | System.out.print("Enter number 1: "); 20 | num1 = in.nextInt(); 21 | System.out.print("Enter number 2: "); 22 | num2 = in.nextInt(); 23 | sum = num1 + num2; 24 | System.out.println("The sum = " + sum); 25 | 26 | System.out.print("Enter number 1: "); 27 | num1 = in.nextInt(); 28 | System.out.print("Enter number 2: "); 29 | num2 = in.nextInt(); 30 | sum = num1 + num2; 31 | System.out.println("The sum = " + sum); 32 | 33 | System.out.print("Enter number 1: "); 34 | num1 = in.nextInt(); 35 | System.out.print("Enter number 2: "); 36 | num2 = in.nextInt(); 37 | sum = num1 + num2; 38 | System.out.println("The sum = " + sum); 39 | 40 | System.out.print("Enter number 1: "); 41 | num1 = in.nextInt(); 42 | System.out.print("Enter number 2: "); 43 | num2 = in.nextInt(); 44 | sum = num1 + num2; 45 | System.out.println("The sum = " + sum); 46 | 47 | System.out.print("Enter number 1: "); 48 | num1 = in.nextInt(); 49 | System.out.print("Enter number 2: "); 50 | num2 = in.nextInt(); 51 | sum = num1 + num2; 52 | System.out.println("The sum = " + sum); 53 | 54 | 55 | System.out.print("Enter number 1: "); 56 | num1 = in.nextInt(); 57 | System.out.print("Enter number 2: "); 58 | num2 = in.nextInt(); 59 | sum = num1 + num2; 60 | System.out.println("The sum = " + sum); 61 | 62 | System.out.print("Enter number 1: "); 63 | num1 = in.nextInt(); 64 | System.out.print("Enter number 2: "); 65 | num2 = in.nextInt(); 66 | sum = num1 + num2; 67 | System.out.println("The sum = " + sum); 68 | 69 | System.out.print("Enter number 1: "); 70 | num1 = in.nextInt(); 71 | System.out.print("Enter number 2: "); 72 | num2 = in.nextInt(); 73 | sum = num1 + num2; 74 | System.out.println("The sum = " + sum); 75 | 76 | System.out.print("Enter number 1: "); 77 | num1 = in.nextInt(); 78 | System.out.print("Enter number 2: "); 79 | num2 = in.nextInt(); 80 | sum = num1 + num2; 81 | System.out.println("The sum = " + sum); 82 | 83 | 84 | System.out.print("Enter number 1: "); 85 | num1 = in.nextInt(); 86 | System.out.print("Enter number 2: "); 87 | num2 = in.nextInt(); 88 | sum = num1 + num2; 89 | System.out.println("The sum = " + sum); 90 | 91 | } 92 | } 93 | -------------------------------------------------------------------------------- /Assignments/04-functions/README.md: -------------------------------------------------------------------------------- 1 | # [Functions / Methods Video Link](https://youtu.be/vvanI8NRlSI) 2 | 3 | 1. [Define two methods to print the maximum and the minimum number respectively among three numbers entered by the user.](https://www.java67.com/2019/05/how-to-find-largest-and-smallest-of-three-numbers-in-java.html) 4 | 5 | 2. [Define a program to find out whether a given number is even or odd.](https://www.geeksforgeeks.org/java-program-to-check-if-a-given-integer-is-odd-or-even/) 6 | 7 | 3. [A person is eligible to vote if his/her age is greater than or equal to 18. Define a method to find out if he/she is eligible to vote.](https://www.efaculty.in/java-programs/voting-age-program-in-java/) 8 | 9 | 4. [Write a program to print the sum of two numbers entered by user by defining your own method.](https://code4coding.com/addition-of-two-numbers-in-java-using-method/) 10 | 11 | 5. [Define a method that returns the product of two numbers entered by user.](https://code4coding.com/java-program-to-multiply-two-numbers-using-method/) 12 | 13 | 6. [Write a program to print the circumference and area of a circle of radius entered by user by defining your own method.](https://beginnersbook.com/2014/01/java-program-to-calculate-area-and-circumference-of-circle/) 14 | 15 | 7. [Define a method to find out if a number is prime or not.](https://www.geeksforgeeks.org/java-program-to-check-if-a-number-is-prime-or-not/) 16 | 17 | 8. [Write a program that will ask the user to enter his/her marks (out of 100). Define a method that will display grades according to the marks entered as below:](https://www.techcrashcourse.com/2017/02/java-program-to-calculate-grade-of-students.html)
18 |
 
19 | Marks        Grade 
20 | 91-100         AA 
21 | 81-90          AB 
22 | 71-80          BB 
23 | 61-70          BC 
24 | 51-60          CD 
25 | 41-50          DD 
26 | <=40          Fail 
27 | 
28 | 29 | 9. [Write a program to print the factorial of a number by defining a method named 'Factorial'.](https://www.javatpoint.com/factorial-program-in-java) 30 | Factorial of any number n is represented by n! and is equal to 1 * 2 * 3 * .... * (n-1) *n. E.g.-
31 |
32 | 4! = 1 * 2 * 3 * 4 = 24 
33 | 3! = 3 * 2 * 1 = 6 
34 | 2! = 2 * 1 = 2 
35 | Also, 
36 | 1! = 1 
37 | 0! = 1
38 | 
39 | 40 | 10. [Write a function to find if a number is a palindrome or not. Take number as parameter.](https://www.geeksforgeeks.org/check-if-a-number-is-palindrome/) 41 | 42 | 11. Convert the programs in [flow of program](https://github.com/kishanrajput23/Java-DSA-Bootcamp/blob/main/Assignments/01-flow-of-program/README.md), [first java](https://github.com/kishanrajput23/Java-DSA-Bootcamp/blob/main/Assignments/02-first-java/README.md), [conditionals & loops](https://github.com/kishanrajput23/Java-DSA-Bootcamp/blob/main/Assignments/03-conditionals-loops/README.md) assignments into functions. 43 | 44 | 12. [Write a function to check if a given triplet is a Pythagorean triplet or not.](https://www.geeksforgeeks.org/find-pythagorean-triplet-in-an-unsorted-array/) (A Pythagorean triplet is when the sum of the square of two numbers is equal to the square of the third number). 45 | 46 | 13. [Write a function that returns all prime numbers between two given numbers.](https://www.geeksforgeeks.org/program-to-find-prime-numbers-between-given-interval/) 47 | 48 | 14. [Write a function that returns the sum of first n natural numbers.](https://www.geeksforgeeks.org/program-find-sum-first-n-natural-numbers/) 49 | -------------------------------------------------------------------------------- /Lectures/05-first-java-program/Notes/type_conversion&casting.txt: -------------------------------------------------------------------------------- 1 | Type Conversion and Casting: 2 | 3 | Java’s Automatic Conversions 4 | When one type of data is assigned to another type of variable, an automatic type conversion will take place if the 5 | following two conditions are met: 6 | • The two types are compatible. 7 | • The destination type is larger than the source type. 8 | Java also performs an automatic type conversion when storing a literal integer constant into variables of type 9 | byte, short, long, or char. 10 | 11 | Casting Incompatible Types 12 | Although the automatic type conversions are helpful, they will not fulfill all needs. For example, what if you want to 13 | assign an int value to a byte variable? This conversion will not be performed automatically, because a byte is smaller 14 | than an int. This kind of conversion is sometimes called a narrowing conversion, since you are explicitly making the 15 | value narrower so that it will fit into the target type. 16 | 17 | For example, the following fragment casts an int to a byte. If the integer’s value is larger than the range of a byte, 18 | it will be reduced modulo (the remainder of an integer division by the) byte’s range. 19 | int a; 20 | byte b; 21 | b = (byte) a; 22 | 23 | A different type of conversion will occur when a floating-point value is assigned to an integer type: truncation. 24 | 25 | Automatic Type Promotion in Expressions: 26 | 27 | int a = 257; 28 | byte b = (byte)a; 29 | When the value 257 is cast into a byte variable, the result is the remainder of the division of 257 by 256 30 | (the range of a byte), which is 1 in this case. 31 | 32 | 33 | byte a = 40; 34 | byte b = 50; 35 | byte c = 100; 36 | int d = a * b / c; 37 | The result of the intermediate term a * b easily exceeds the range of either of its byte operands. 38 | To handle this kind of problem, Java automatically promotes each byte, short, or char operand to int when evaluating 39 | an expression. This means that the subexpression a*b is performed using integers—not bytes. 40 | byte b = 50; 41 | b = b * 2; // Error! Cannot assign an int to a byte! 42 | The code is attempting to store 50 * 2, a perfectly valid byte value, back into a byte variable. However, because the 43 | operands were automatically promoted to int when the expression was evaluated, the result has also been promoted to int. 44 | 45 | The Type Promotion Rules: 46 | 47 | Java defines several type promotion rules that apply to expressions. 48 | They are as follows: First, all byte, short, and char values are promoted to int, as just described. 49 | Then, if one operand is a long, the whole expression is promoted to long. If one operand is a float, 50 | the entire expression is promoted to float. If any of the operands are double, the result is double. 51 | 52 | class Promote { 53 | public static void main(String args[]) { 54 | byte b = 42; 55 | char c = 'a'; 56 | short s = 1024; 57 | int i = 50000; 58 | float f = 5.67f; 59 | double d = .1234; 60 | double result = (f * b) + (i / c) - (d * s); 61 | System.out.println((f * b) + " + " + (i / c) + " - " + (d * s)); 62 | System.out.println("result = " + result); 63 | } 64 | } 65 | Let’s look closely at the type promotions that occur in this line from the program: 66 | 67 | double result = (f * b) + (i / c) - (d * s); 68 | 69 | In the first subexpression, f * b, b is promoted to a float and the result of the subexpression is float. 70 | Next, in the subexpression i/c, c is promoted to int, and the result is of type int. Then, in d * s, the value of s is 71 | promoted to double, and the type of the subexpression is double. Finally, these three intermediate values, float, int, 72 | and double, are considered. The outcome of float plus an int is a float. Then the resultant float minus the last double 73 | is promoted to double, which is the type for the final result of the expression. 74 | -------------------------------------------------------------------------------- /Assignments/05-arrays/README.md: -------------------------------------------------------------------------------- 1 | # [Arrays Video Link](https://youtu.be/n60Dn0UsbEk) 2 | 3 | ## Submit the following on your Leetcode profile itself. 4 | 5 | ### Easy 6 | 1. [Build Array from Permutation](https://leetcode.com/problems/build-array-from-permutation/) 7 | 2. [Concatenation of Array](https://leetcode.com/problems/concatenation-of-array/) 8 | 3. [Running Sum of 1d Array](https://leetcode.com/problems/running-sum-of-1d-array/) 9 | 4. [Richest Customer Wealth](https://leetcode.com/problems/richest-customer-wealth/) 10 | 5. [Shuffle the Array](https://leetcode.com/problems/shuffle-the-array/) 11 | 6. [Kids With the Greatest Number of Candies](https://leetcode.com/problems/kids-with-the-greatest-number-of-candies/) 12 | 7. [Number of Good Pairs](https://leetcode.com/problems/number-of-good-pairs/) 13 | 8. [How Many Numbers Are Smaller Than the Current Number](https://leetcode.com/problems/how-many-numbers-are-smaller-than-the-current-number/) 14 | 9. [Create Target Array in the Given Order](https://leetcode.com/problems/create-target-array-in-the-given-order/) 15 | 10. [Check if the Sentence Is Pangram](https://leetcode.com/problems/check-if-the-sentence-is-pangram/) 16 | 11. [Count Items Matching a Rule](https://leetcode.com/problems/count-items-matching-a-rule/) 17 | 12. [Find the Highest Altitude](https://leetcode.com/problems/find-the-highest-altitude/) 18 | 13. [Flipping an Image](https://leetcode.com/problems/flipping-an-image/) 19 | 14. [Cells with Odd Values in a Matrix](https://leetcode.com/problems/cells-with-odd-values-in-a-matrix/) 20 | 15. [Matrix Diagonal Sum](https://leetcode.com/problems/matrix-diagonal-sum/) 21 | 16. [Find Numbers with Even Number of Digits](https://leetcode.com/problems/find-numbers-with-even-number-of-digits/) 22 | 17. [Transpose Matrix](https://leetcode.com/problems/transpose-matrix/) 23 | 18. [Add to Array-Form of Integer](https://leetcode.com/problems/add-to-array-form-of-integer/) 24 | 19. [Maximum Population Year](https://leetcode.com/problems/maximum-population-year/) 25 | 20. [Determine Whether Matrix Can Be Obtained By Rotation](https://leetcode.com/problems/determine-whether-matrix-can-be-obtained-by-rotation/) 26 | 21. [Two Sum](https://leetcode.com/problems/two-sum/) 27 | 22. [Find N Unique Integers Sum up to Zero](https://leetcode.com/problems/find-n-unique-integers-sum-up-to-zero/) 28 | 23. [Lucky Number In a Matrix](https://leetcode.com/problems/lucky-numbers-in-a-matrix/) 29 | 24. [Maximum Subarray](https://leetcode.com/problems/maximum-subarray/) 30 | 25. [Reshape the Matrix](https://leetcode.com/problems/reshape-the-matrix/) 31 | 26. [Plus One](https://leetcode.com/problems/plus-one/) 32 | 27. [Remove Duplicates from Sorted Array](https://leetcode.com/problems/remove-duplicates-from-sorted-array/) 33 | 28. [Minimum Cost to Move Chips to The Same Position](https://leetcode.com/problems/minimum-cost-to-move-chips-to-the-same-position/) 34 | 35 | ### Medium 36 | 1. [Spiral Matrix](https://leetcode.com/problems/spiral-matrix/) 37 | 2. [Spiral Matrix II](https://leetcode.com/problems/spiral-matrix-ii/) 38 | 3. [Spiral Matrix III](https://leetcode.com/problems/spiral-matrix-iii/) 39 | 4. [Set Matrix Zeroes](https://leetcode.com/problems/set-matrix-zeroes/) 40 | 5. [Product of Array Except Self](https://leetcode.com/problems/product-of-array-except-self/) 41 | 6. [Find First and Last Position of Element in Sorted Array](https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array/) 42 | 7. [Jump Game](https://leetcode.com/problems/jump-game/) 43 | 8. [Rotate Array](https://leetcode.com/problems/rotate-array/) 44 | 9. [Sort Colors](https://leetcode.com/problems/sort-colors/) 45 | 10. [House Robber](https://leetcode.com/problems/house-robber/) 46 | 47 | ### Hard 48 | 1. [Max Value of Equation](https://leetcode.com/problems/max-value-of-equation/) 49 | 2. [First Missing Positive](https://leetcode.com/problems/first-missing-positive/) 50 | 3. [Good Array](https://leetcode.com/problems/check-if-it-is-a-good-array/) 51 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Java-DSA-Bootcamp🔥 2 | 3 |
4 | 5 | Go to [`Kunal Kushwaha's 👨🏻‍💻`](https://github.com/kunal-kushwaha) course repository : [`☕ Java DSA Bootcamp`](https://github.com/kunal-kushwaha/DSA-Bootcamp-Java) 6 | 7 | [![Welcome to my profile](https://img.shields.io/badge/Hello,Programmer!-Welcome-blue.svg?style=flat&logo=github)](https://github.com/kishanrajput23) 8 | [![Open Source Love](https://badges.frapsoft.com/os/v2/open-source.svg?v=103)](https://github.com/kishanrajput23/Java-DSA-Bootcamp) 9 | 10 |
11 | 12 | ![Java-DSA-Bootcamp](https://socialify.git.ci/kishanrajput23/Java-DSA-Bootcamp/image?description=1&descriptionEditable=This%20repository%20consists%20of%20all%20lecture%20codes%2C%20notes%20%26%20solutions%20for%20the%20Community%20Classroom%20complete%20DSA%20Java%20Bootcamp.&font=Bitter&forks=1&issues=1&language=1&owner=1&pattern=Plus&pulls=1&stargazers=1&theme=Dark) 13 | 14 |

Connect with Community:

15 |

16 | 17 | 18 | 19 |

20 | 21 |

Connect with Kunal Kushwaha:

22 |

23 | 24 | 25 | 26 | 27 |

28 | 29 | 30 |

Connect with me:

31 |

32 | kishan_rajput23 33 | kishan-kumar-rai-23112000 34 | kishan_rajput23 35 | codingbuddies 36 | kishan.kumarrai.79 37 | kishan_rai99693 38 | kishan_rajput23 39 | kishanrajput23 40 |

41 | 42 | ## Assignment Author 👷 43 | 44 | - [`👨🏻‍💻 Kishan Kumar Rai 👨🏻‍💻`](https://github.com/kishanrajput23) 45 | 46 | 47 |
48 | love 49 | how 50 |
51 | -------------------------------------------------------------------------------- /Lectures/README.md: -------------------------------------------------------------------------------- 1 | # Complete Java + DSA Bootcamp Syllabus 2 | 3 | ## NOTE 4 | - All topics will contain problems from LeetCode Easy to Hard, explained in an easy-to-understand manner. 5 | - Complete custom implementation of all Data Structures and Algorithms. 6 | 7 | ## Lectures 8 | - [Complete Git & GitHub Course](https://youtu.be/apGV9Kg7ics) 9 | - [Introduction to Programming](https://youtu.be/wn49bJOYAZM) 10 | - [Types of languages](https://youtu.be/wn49bJOYAZM?t=171) 11 | - [Memory management](https://youtu.be/wn49bJOYAZM?t=1488) 12 | - [Flow of the program](https://youtu.be/lhELGQAV4gg) 13 | - [Flowcharts](https://youtu.be/lhELGQAV4gg) 14 | - [Pseudocode](https://youtu.be/lhELGQAV4gg?t=715) 15 | - [Introduction to Java](https://youtu.be/4EP8YzcN0hQ) 16 | - [Introduction](https://youtu.be/4EP8YzcN0hQ) 17 | - [How it works](https://youtu.be/4EP8YzcN0hQ?t=93) 18 | - [Setup Installation](https://youtu.be/4EP8YzcN0hQ?t=1486) 19 | - [Input and Output in Java](https://youtu.be/TAtrPoaJ7gc) 20 | - [Conditionals & Loops in Java](https://youtu.be/ldYLYRNaucM?t=88) 21 | - [if-else](https://youtu.be/ldYLYRNaucM?t=88) 22 | - [loops](https://youtu.be/ldYLYRNaucM?t=440) 23 | - [Switch statements](https://youtu.be/mA23x39DjbI) 24 | - [Data-types](https://youtu.be/TAtrPoaJ7gc?t=2800) 25 | - [Coding best practices](https://youtu.be/waGfV-IoOt8) 26 | - [Functions](https://youtu.be/vvanI8NRlSI) 27 | - [Introduction](https://youtu.be/vvanI8NRlSI) 28 | - [Scoping in Java](https://youtu.be/vvanI8NRlSI?t=2801) 29 | - [Shadowing](https://youtu.be/vvanI8NRlSI?t=3584) 30 | - [Variable Length Arguments](https://youtu.be/vvanI8NRlSI?t=4013) 31 | - [Overloading](https://youtu.be/vvanI8NRlSI?t=4327) 32 | - [Arrays](https://youtu.be/n60Dn0UsbEk) 33 | - [Introduction](https://youtu.be/n60Dn0UsbEk) 34 | - [Memory management](https://youtu.be/n60Dn0UsbEk?t=632) 35 | - [Input and Output](https://youtu.be/n60Dn0UsbEk?t=1675) 36 | - [ArrayList Introduction](https://youtu.be/n60Dn0UsbEk?t=4868) 37 | - Searching 38 | - [Linear Search](https://youtu.be/_HRA37X8N_Q) 39 | - [Binary Search](https://youtu.be/f6UU7V3szVw) 40 | - [Modified Binary Search](https://youtu.be/f6UU7V3szVw?t=2508) 41 | - [Binary Search on 2D Arrays](https://www.youtube.com/watch?v=enI_KyGLYPo) 42 | - Sorting 43 | - [Insertion Sort](https://youtu.be/By_5-RRqVeE) 44 | - [Selection Sort](https://youtu.be/Nd4SCCIHFWk) 45 | - [Bubble Sort](https://youtu.be/F5MZyqRp_IM) 46 | - [Cyclic Sort](https://youtu.be/JfinxytTYFQ) 47 | - [Pattern questions](https://youtu.be/lsOOs5J8ycw) 48 | - [Strings](https://www.youtube.com/watch?v=zL1DPZ0Ovlo) 49 | - [Introduction](https://www.youtube.com/watch?v=zL1DPZ0Ovlo) 50 | - [How Strings work](https://youtu.be/zL1DPZ0Ovlo?t=216) 51 | - [Comparison of methods](https://youtu.be/zL1DPZ0Ovlo?t=977) 52 | - [Operations in Strings](https://youtu.be/zL1DPZ0Ovlo?t=1681) 53 | - [StringBuilder in java](https://youtu.be/zL1DPZ0Ovlo?t=4199) 54 | - [Maths for DSA](https://youtu.be/fzip9Aml6og) 55 | - [Introduction](https://youtu.be/fzip9Aml6og?t=20) 56 | - [Complete Bitwise Operators](https://youtu.be/fzip9Aml6og?t=95) 57 | - [Range of numbers](https://youtu.be/fzip9Aml6og?t=4169) 58 | - [Prime numbers](https://youtu.be/lmSpZ0bjCyQ?t=57) 59 | - [Sieve of Eratosthenes](https://youtu.be/lmSpZ0bjCyQ?t=850) 60 | - [Newton's Square Root Method](https://youtu.be/lmSpZ0bjCyQ?t=1989) 61 | - [Factors](https://youtu.be/lmSpZ0bjCyQ?t=3004) 62 | - [Modulo properties](https://youtu.be/lmSpZ0bjCyQ?t=3980) 63 | - [Number Theory](https://youtu.be/lmSpZ0bjCyQ?t=4405) 64 | - [HCF / LCM](https://youtu.be/lmSpZ0bjCyQ?t=5110) 65 | - [Euclidean algorithm](https://youtu.be/lmSpZ0bjCyQ?t=5520) 66 | - [Recursion](https://www.youtube.com/playlist?list=PL9gnSGHSqcnp39cTyB1dTZ2pJ04Xmdrod) 67 | - [Introduction](https://youtu.be/M2uO2nMT0Bk) 68 | - [Flow of recursive programs - stacks](https://youtu.be/M2uO2nMT0Bk?t=2124) 69 | - [Why recursion?](https://youtu.be/M2uO2nMT0Bk?t=2708) 70 | - [Tree building of function calls](https://youtu.be/M2uO2nMT0Bk?t=3033) 71 | - [Tail recursion](https://youtu.be/M2uO2nMT0Bk?t=4308) 72 | - [Sorting](https://www.youtube.com/playlist?list=PL9gnSGHSqcnq-9CXLt9DsInytRMLoyZQ_) 73 | - [Merge Sort](https://youtu.be/iKGAgWdgoRk) 74 | - [Quick Sort](https://www.youtube.com/watch?v=Z8svOqamag8&list=PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ&index=27) 75 | - [Backtracking](https://youtu.be/zg5v2rlV1tM) 76 | - [N-Queens](https://youtu.be/nC1rbW2YSz0) 77 | - [N-Knights](https://youtu.be/nC1rbW2YSz0?t=2342) 78 | - [Sudoku Solver](https://youtu.be/nC1rbW2YSz0?t=3190) 79 | - [Maze problems](https://www.youtube.com/watch?v=zg5v2rlV1tM) 80 | - [Recursion String Problems](https://youtu.be/gdifkIwCJyg) 81 | - [Recursion Google, Amazon Questions](https://youtu.be/9ByWqPzfXDU) 82 | - [Recursion Array Problems](https://youtu.be/sTdiMLom00U) 83 | - [Recursion Pattern Problems](https://youtu.be/ymgnIIclCF0) 84 | - [Subset Questions](https://youtu.be/9ByWqPzfXDU) 85 | - [Space and Time Complexity Analysis](https://youtu.be/mV3wrLBbuuE) 86 | - [Introduction](https://youtu.be/mV3wrLBbuuE) 87 | - [Comparisons of various cases](https://youtu.be/mV3wrLBbuuE?t=1039) 88 | - [Solving Linear Recurrence Relations](https://youtu.be/mV3wrLBbuuE?t=6252) 89 | - [Solving Divide and Conquer Recurrence Relations](https://youtu.be/mV3wrLBbuuE?t=4609) 90 | - [Big-O, Big-Omega, Big-Theta Notations](https://youtu.be/mV3wrLBbuuE?t=2271) 91 | - [Little Notations](https://youtu.be/mV3wrLBbuuE?t=2960) 92 | - [Get equation of any relation easily - best and easiest approach](https://youtu.be/mV3wrLBbuuE?t=8189) 93 | - [Complexity discussion of all the problems we do](https://youtu.be/mV3wrLBbuuE?t=3866) 94 | - [Space Complexity](https://youtu.be/mV3wrLBbuuE?t=3330) 95 | - [NP-Completeness Introduction](https://youtu.be/mV3wrLBbuuE?t=8695) 96 | - [Object Oriented Programming](https://www.youtube.com/playlist?list=PL9gnSGHSqcno1G3XjUbwzXHL8_EttOuKk) 97 | - [Introduction](https://www.youtube.com/watch?v=BSVKUk58K6U) 98 | - [Classes & its instances](https://youtu.be/BSVKUk58K6U?t=467) 99 | - [this keyword in Java](https://youtu.be/BSVKUk58K6U?t=3380) 100 | - [Properties](https://www.youtube.com/watch?v=46T2wD3IuhM) 101 | - [Inheritance](https://youtu.be/46T2wD3IuhM?t=146) 102 | - [Abstraction](https://youtu.be/46T2wD3IuhM?t=7102) 103 | - [Polymorphism](https://youtu.be/46T2wD3IuhM?t=4226) 104 | - [Encapsulation](https://youtu.be/46T2wD3IuhM?t=7022) 105 | - [Overloading & Overriding](https://youtu.be/46T2wD3IuhM?t=4834) 106 | - [Static & Non-Static](https://youtu.be/_Ya6CN13t8k?t=1137) 107 | - [Packages](https://youtu.be/_Ya6CN13t8k?t=182) 108 | - [Access Control](https://youtu.be/W145DXs8fFg) 109 | - [Interfaces](https://youtu.be/rgHZa7-Dibg?t=1510) 110 | - [Abstract Classes](https://youtu.be/rgHZa7-Dibg?t=68) 111 | - [Annotations](https://youtu.be/rgHZa7-Dibg?t=3438) 112 | - [Singleton Class](https://youtu.be/_Ya6CN13t8k?t=4240) 113 | - [final, finalize, finally](https://youtu.be/46T2wD3IuhM?t=6317) 114 | - [Object Cloning](https://youtu.be/OY2lPr8h93U?t=4352) 115 | - [Object Class](https://youtu.be/W145DXs8fFg?t=1943) 116 | - [Generics](https://www.youtube.com/watch?v=OY2lPr8h93U) 117 | - [Exception Handling](https://youtu.be/OY2lPr8h93U?t=3405) 118 | - [Collections Framework](https://youtu.be/9ogGan-R1pc?t=49) 119 | - [Vector Class](https://youtu.be/9ogGan-R1pc?t=668) 120 | - [Lambda Expression](https://youtu.be/OY2lPr8h93U?t=2894) 121 | - [Enums](https://youtu.be/9ogGan-R1pc?t=909) 122 | - Linked List 123 | - [Introduction](https://youtu.be/58YbpRDc4yw) 124 | - [Singly + Doubly + Circular LinkedList](https://youtu.be/58YbpRDc4yw) 125 | - [Fast and slow pointer](https://youtu.be/70tx7KcMROc) 126 | - [Cycle Detection](https://youtu.be/70tx7KcMROc) 127 | - [Reversal of LinkedList](https://youtu.be/70tx7KcMROc) 128 | - [Linked List + Recursion](https://youtu.be/70tx7KcMROc) 129 | - Stacks & Queues 130 | - Introduction 131 | - Interview problems 132 | - Push efficient 133 | - Pop efficient 134 | - Queue using Stack and Vice versa 135 | - Circular Queue 136 | - Trees 137 | - Introduction 138 | - Binary Trees 139 | - Binary Search Trees 140 | - DFS 141 | - BFS 142 | - AVL Trees 143 | - Segment Tree 144 | - Heaps 145 | - Introduction 146 | - Theory 147 | - Priority Queue 148 | - Heapsort 149 | - Two Heaps Method 150 | - k-way merge 151 | - Top k elements 152 | - Interval problems 153 | - HashMap 154 | - Introduction 155 | - Theory - how it works 156 | - Comparisons of various forms 157 | - Limitations and how to solve 158 | - Map using LinkedList 159 | - Map using Hash 160 | - Count Sort 161 | - Radix Sort 162 | - Chaining 163 | - Probing 164 | - Huffman-Encoder 165 | - Subarray Questions: Sliding window, Two Pointer, Kadane's Algorithm 166 | - Graphs 167 | - Introduction 168 | - BFS 169 | - DFS 170 | - Working with graph components 171 | - Minimum Spanning Trees 172 | - Kruskal Algorithm 173 | - Prims Algorithm 174 | - Dijkstra’s shortest path algorithm 175 | - Topological Sort 176 | - Bellman ford 177 | - A* pathfinding Algorithm 178 | - Dynamic Programming 179 | - Introduction 180 | - Recursion + Recursion DP + Iteration + Iteration Space Optimized 181 | - Complexity Analysis 182 | - 0/1 Knapsack 183 | - Subset Questions 184 | - Unbounded Knapsack 185 | - Subsequence questions 186 | - String DP 187 | - Greedy Algorithms 188 | - Tries 189 | 190 | ### Advanced concepts apart from interviews 191 | - Fast IO 192 | - File handling 193 | - Bitwise + DP 194 | - Extended Euclidean algorithm 195 | - Modulo Multiplicative Inverse 196 | - Linear Diophantine Equations 197 | - Matrix Exponentiation 198 | - Mathematical Expectation 199 | - Catalan Numbers 200 | - Fermat’s Theorem 201 | - Wilson's Theorem 202 | - Euler's Theorem 203 | - Lucas Theorem 204 | - Chinese Remainder Theorem 205 | - Euler Totient 206 | - NP-Completeness 207 | - Multithreading 208 | - Fenwick Tree / Binary Indexed Tree 209 | - Square Root Decomposition 210 | --------------------------------------------------------------------------------