That’s quite a comprehensive list of programming problems! Here’s a structured breakdown for clarity, grouped by category:


Problems on Arrays

  1. Basic Operations

    • Find the smallest number in an array
    • Find the largest number in an array
    • Second smallest and second largest elements in an array
    • Reverse a given array
    • Count frequency of each element in an array
    • Calculate the sum of the elements of the array
    • Average of all elements in an array
    • Find the median of the given array

  2. Rearrangement and Rotation

    • Rearrange array in increasing-decreasing order
    • Rotate the array by K elements (Block Swap Algorithm)
    • Remove duplicates from a sorted array
    • Remove duplicates from an unsorted array
    • Rotation of elements of array (left and right)
    • Finding circular rotation of an array by K positions


  3. Search and Rank

    • Search an element in an array
    • Replace each element of the array by its rank
    • Sort elements of an array by frequency
    • Sort an array according to the order defined by another array
    • Check if an array is a subset of another array


  4. Special Problems

    • Find all repeating elements in an array
    • Find all non-repeating elements in an array
    • Find all symmetric pairs in an array
    • Maximum product subarray in an array
    • Finding equilibrium index of an array

Problems on Numbers

  1. Number Properties

    • Check if a number is palindrome
    • Find all palindrome numbers in a given range
    • Check if a number is prime
    • Prime numbers in a given range
    • Check if a number is Armstrong
    • Check if a number is a perfect number
    • Check if a number is even or odd
    • Check if a number is positive or negative


  2. Series and Sums

    • Sum of first N natural numbers
    • Sum of an AP series
    • Sum of a GP series
    • Sum of numbers in a given range


  3. Comparisons and Operations

    • Greatest of two numbers
    • Greatest of three numbers
    • Leap year or not
    • Reverse digits of a number
    • Maximum and minimum digit in a number
    • Factorial of a number
    • Power of a number
    • Factors of a given number
    • Print all prime factors of a given number
    • GCD and LCM of two numbers


  4. Special Numbers

    • Check if a number is a strong number
    • Check if a number is automorphic
    • Check if a number is Harshad
    • Check if a number is abundant


  5. Other

    • Permutations of N people occupying R seats
    • Program to add two fractions
    • Replace all 0s with 1s in a number
    • Check if a number can be expressed as a sum of two primes
    • Calculate the area of a circle
    • Find roots of a quadratic equation

Problems on Number Systems

  1. Conversions

    • Binary to Decimal
    • Binary to Octal
    • Decimal to Binary
    • Decimal to Octal
    • Octal to Binary
    • Octal to Decimal


  2. Extras

    • Convert digits/numbers to words

Problems on Sorting

  1. Algorithms
    • Bubble Sort
    • Selection Sort
    • Insertion Sort
    • Quick Sort
    • Merge Sort

Problems on Strings

  1. Basic Operations

    • Check if a string is a palindrome
    • Reverse a string
    • Count number of vowels, consonants, spaces
    • Remove all vowels from a string
    • Remove spaces from a string
    • Remove characters except alphabets


  2. Frequency and Characters

    • Frequency of characters
    • Find non-repeating characters
    • Maximum occurring character
    • Remove duplicates
    • Print all duplicates


  3. Manipulations

    • Capitalize first and last character of each word
    • Change every letter to the next lexicographic alphabet
    • Change case of each character
    • Concatenate two strings


  4. Search and Substrings

    • Find a substring and its starting position
    • Find a word with the highest number of repeated letters


  5. Miscellaneous

    • Reverse words in a string
    • Sort characters in a string
    • Count words in a string
    • Check if two strings are anagrams
    • Handle wildcards in string matches
    • Remove characters of one string from another
01. Problems on Arrays - Basic Operations
				
					# 1. Find the smallest number in an array
def find_smallest(arr):
    return min(arr)

# 2. Find the largest number in an array
def find_largest(arr):
    return max(arr)

# 3. Second smallest and second largest elements in an array
def find_second_smallest_largest(arr):
    unique_sorted = sorted(set(arr))
    if len(unique_sorted) < 2:
        return None, None  # Not enough elements
    return unique_sorted[1], unique_sorted[-2]

# 4. Reverse a given array
def reverse_array(arr):
    return arr[::-1]

# 5. Count frequency of each element in an array
from collections import Counter
def count_frequency(arr):
    return dict(Counter(arr))

# 6. Calculate the sum of the elements of the array
def calculate_sum(arr):
    return sum(arr)

# 7. Average of all elements in an array
def calculate_average(arr):
    return sum(arr) / len(arr) if arr else 0

# 8. Find the median of the given array
def find_median(arr):
    arr_sorted = sorted(arr)
    n = len(arr_sorted)
    mid = n // 2
    if n % 2 == 0:
        return (arr_sorted[mid - 1] + arr_sorted[mid]) / 2
    else:
        return arr_sorted[mid]

# Example usage
array = [7, 2, 9, 1, 4, 6, 2]

print("Smallest:", find_smallest(array))
print("Largest:", find_largest(array))
second_smallest, second_largest = find_second_smallest_largest(array)
print("Second Smallest:", second_smallest)
print("Second Largest:", second_largest)
print("Reversed Array:", reverse_array(array))
print("Frequency Count:", count_frequency(array))
print("Sum of Elements:", calculate_sum(array))
print("Average of Elements:", calculate_average(array))
print("Median:", find_median(array))

				
			
				
					# 1. Rearrange array in increasing-decreasing order
def rearrange_increasing_decreasing(arr):
    arr.sort()
    mid = len(arr) // 2
    return arr[:mid] + arr[mid:][::-1]

# 2. Rotate the array by K elements (Block Swap Algorithm)
def rotate_array(arr, k):
    def swap_blocks(arr, start, end, d):
        for i in range(d):
            arr[start + i], arr[end + i] = arr[end + i], arr[start + i]

    n = len(arr)
    k %= n
    if k == 0:
        return arr
    i, j = k, n - k
    while i != j:
        if i < j:
            swap_blocks(arr, k - i, k + j - i, i)
            j -= i
        else:
            swap_blocks(arr, k - i, k, j)
            i -= j
    swap_blocks(arr, k - i, k, i)
    return arr

# 3. Remove duplicates from a sorted array
def remove_duplicates_sorted(arr):
    return list(dict.fromkeys(arr))

# 4. Remove duplicates from an unsorted array
def remove_duplicates_unsorted(arr):
    return list(dict.fromkeys(arr))

# 5. Rotation of elements of array (left and right)
def rotate_left(arr, k):
    k %= len(arr)
    return arr[k:] + arr[:k]

def rotate_right(arr, k):
    k %= len(arr)
    return arr[-k:] + arr[:-k]

# 6. Finding circular rotation of an array by K positions
def circular_rotation(arr, k):
    return rotate_left(arr, k)

# Example usage
if __name__ == "__main__":
    array = [7, 2, 9, 1, 4, 6, 2]
    print("Original Array:", array)

    # 1. Rearrange in increasing-decreasing order
    print("Rearranged (Increasing-Decreasing):", rearrange_increasing_decreasing(array))

    # 2. Rotate array by K elements
    print("Rotated Array by 2 (Block Swap):", rotate_array(array.copy(), 2))

    # 3. Remove duplicates from sorted array
    print("Remove Duplicates (Sorted):", remove_duplicates_sorted(sorted(array)))

    # 4. Remove duplicates from unsorted array
    print("Remove Duplicates (Unsorted):", remove_duplicates_unsorted(array))

    # 5. Rotation of elements (left and right)
    print("Left Rotation by 2:", rotate_left(array, 2))
    print("Right Rotation by 2:", rotate_right(array, 2))

    # 6. Circular rotation by K positions
    print("Circular Rotation by 3:", circular_rotation(array, 3))

				
			

DSA Practice Sheet

*Company wise details for Questions coming soon.
Note – This Sheet is only meant for Prime & Super Students.

Coding Practice Sheet

*Company wise details for Questions coming soon.
Note – This Sheet is only meant for Prime & Super Students.

  • Sum of Natural Numbers
  • Count Digits
  • Palindrome Number
  • Factorial of a Number
  • Trailing Zeros in Factorial
  • GCD or HCF of Two Numbers
  • LCM of Two Numbers
  • Check for Prime
  • Prime Factorization
  • All Divisors of a Number
  • Sieve of Eratosthenes
  • Computing Power
  • Iterative Power (Binary Exponentiation)

  • List (Dynamic Sized Array) Introduction
  • Working of List in Python
  • Average or Mean of a List
  • Separate Even and Odd
  • Get Smaller Elements
  • Slicing (List, Tuple, and String)
  • Comprehensions in Python
  • Largest Element in a List
  • Second Largest Element in a List
  • Check if a List is Sorted
  • Reverse a List in Python
  • Remove Duplicates
  • Left Rotate a List by One