Posts

📘 DAY 1 (1-50): FOUNDATION - SSC CGL

  📘 DAY 1: FOUNDATION We’ll cover today: Reasoning – Number Series Quant – Number System Basics English – Vocabulary & Error Spotting GK – Indian Polity + Current Affairs 🧠 1. Reasoning – Number Series 🔍 Concept: A number series is a sequence that follows a logical rule. Your task is to find the next number or find the wrong one. 🧩 Example Patterns : Addition: 2, 4, 6, 8, __ (Answer: 10) Multiplication: 3, 6, 12, 24, __ (Answer: 48) Squares: 1, 4, 9, 16, __ (Answer: 25) Fibonacci: 1, 1, 2, 3, 5, 8, __ (Answer: 13) 🎯 Practice Now (Try these): 2, 6, 12, 20, 30, ? 5, 10, 20, 40, ? 100, 81, 64, 49, ? 1, 4, 9, 16, 25, ? 📌 Write answers and reply — I’ll check and explain. 📐 2. Quant – Number System Basics ✍️ Concepts: Types of Numbers: Natural: 1, 2, 3... Whole: 0, 1, 2... Even: 2, 4, 6... Prime: 2, 3, 5, 7... Divisibility Rules (Learn today for 2 to 6) Div by 2: Ends in 0, 2, 4, 6, 8 Div by 3:...

✅ Topics for Day 6 DSA with Java

Focus : Two Pointer Technique 🔁 1. Learn & Implement Two Pointer Technique Understand how the two-pointer technique works on sorted arrays. Implement the following problems: // Java Example: Two Sum (Sorted Array) public int [] twoSum( int [] numbers, int target) { int left = 0 , right = numbers.length - 1 ; while (left < right) { int sum = numbers[left] + numbers[right]; if (sum == target) { return new int [] { left + 1 , right + 1 }; // 1-indexed } else if (sum < target) { left++; } else { right--; } } return new int [] {}; // no solution } 🧠 2. Solve 2 LeetCode Problems Using Two Pointers LeetCode 167. Two Sum II – Input Array Is Sorted LeetCode 283. Move Zeroes Optimize with minimal swaps using the two-pointer pattern. ✨ Bonus Challenges (Optional but Recommended) LeetCode 26. Remove Duplicates from Sorted Array LeetCode 844....

✅ Day 5 Solution - DSA with Java

  ✅ 1. Implement Merge Sort and Quick Sort 🔹 Merge Sort public class MergeSort { public static void mergeSort ( int [] arr, int left, int right) { if (left < right) { int mid = (left + right) / 2 ; mergeSort(arr, left, mid); mergeSort(arr, mid + 1 , right); merge(arr, left, mid, right); } } public static void merge ( int [] arr, int left, int mid, int right) { int n1 = mid - left + 1 , n2 = right - mid; int [] L = new int [n1]; int [] R = new int [n2]; for ( int i = 0 ; i < n1; i++) L[i] = arr[left + i]; for ( int j = 0 ; j < n2; j++) R[j] = arr[mid + 1 + j]; int i = 0 , j = 0 , k = left; while (i < n1 && j < n2) { if (L[i] <= R[j]) arr[k++] = L[i++]; else arr[k++] = R[j++]; } while (i < n1) arr[k++] = L[i++]; while (j < n2) ...

🚀 Day 5: Merge Sort & Quick Sort in Java 🎯 Goals for Today

Understand the Divide and Conquer strategy Learn and implement: Merge Sort Quick Sort Analyze Time & Space Complexities Solve intermediate-level sorting problems 📘 1. Merge Sort A stable, divide-and-conquer sorting algorithm. Time Complexity : O(n log n) in all cases Space Complexity : O(n) (extra array) ✅ Logic: Divide the array into two halves Sort each half recursively Merge the two sorted halves 🔹 Java Implementation public class MergeSort { public static void mergeSort ( int [] arr, int left, int right) { if (left < right) { int mid = (left + right) / 2 ; // Sort the left and right halves mergeSort(arr, left, mid); mergeSort(arr, mid + 1 , right); // Merge them merge(arr, left, mid, right); } } public static void merge ( int [] arr, int left, int mid, int right) { int n1 = mid - left + 1 ; ...

✅ Day 4 Solution - DSA with Java

  ✅ 1. Implement All Three Sorting Algorithms 🔹 Bubble Sort public class BubbleSort { public static void bubbleSort ( int [] arr) { int n = arr.length; for ( int i = 0 ; i < n - 1 ; i++) { boolean swapped = false ; for ( int j = 0 ; j < n - i - 1 ; j++) { if (arr[j] > arr[j + 1 ]) { // Swap int temp = arr[j]; arr[j] = arr[j + 1 ]; arr[j + 1 ] = temp; swapped = true ; } } if (!swapped) break ; // Optimization } } } 🔹 Selection Sort public class SelectionSort { public static void selectionSort ( int [] arr) { int n = arr.length; for ( int i = 0 ; i < n - 1 ; i++) { int minIdx = i; for ( int j = i + 1 ; j < n; j++) { if (arr[j] < arr[minIdx]) { ...

✅ Day 5 Solution - DSA with C

  ✅ 1. Implement your own strlen() # include <stdio.h> int my_strlen ( char str[]) { int i = 0 ; while (str[i] != '\0' ) { i++; } return i; } int main () { char str[ 100 ]; printf ( "Enter a string: " ); scanf ( "%s" , str); printf ( "Length of string = %d\n" , my_strlen(str)); return 0 ; } ✅ 2. Implement your own strcpy() # include <stdio.h> void my_strcpy ( char dest[], char src[]) { int i = 0 ; while (src[i] != '\0' ) { dest[i] = src[i]; i++; } dest[i] = '\0' ; // Null-terminate } int main () { char src[ 100 ], dest[ 100 ]; printf ( "Enter a string to copy: " ); scanf ( "%s" , src); my_strcpy(dest, src); printf ( "Copied string: %s\n" , dest); return 0 ; } ✅ 3. Implement your own strcmp() # include <stdio.h> int my_strcmp ( char str1[], char st...

🚀 DSA with C – Day 5: Strings in C

🎯 Goal: Understand how strings work in C Perform common string operations: Reverse a string Check for palindrome Count character frequency Check if two strings are anagrams 🧠 What is a String in C? A string is a character array ending with a null character ( \0 ) . 🔧 Declaration char str[ 100 ]; // Character array 📥 Input scanf ( "%s" , str); // No spaces fgets(str, sizeof (str), stdin ); // With spaces 👨‍💻 1. Reverse a String # include <stdio.h> # include <string.h> int main () { char str[ 100 ]; printf ( "Enter a string: " ); scanf ( "%s" , str); // Use fgets if you want spaces int len = strlen (str); for ( int i = 0 ; i < len / 2 ; i++) { char temp = str[i]; str[i] = str[len - i - 1 ]; str[len - i - 1 ] = temp; } printf ( "Reversed string: %s\n" , str); return 0 ; } 👨‍💻 2. Check if a String is a Palindrome ...