📚 Logical Building — Basic to Advanced
By Developers_Route
⭐ Pattern Problems
- Square Star Pattern
- Inverted Pyramid Star Pattern
- Pyramid Star Pattern
- Diamond Star Pattern
- Hollow Square Star Pattern
- Butterfly Pattern
- Downward Triangle Star Pattern
- Hollow Diamond Star Pattern
- Cross Star Pattern
- Hollow Pyramid Star Pattern
📊 Array Problems
- Reverse an array in place.
- Find the maximum and minimum elements in an array.
- Rotate an array to the right by K steps.
- Find the second largest element in an array.
- Check if two arrays are rotations of each other.
- Find all pairs in an array whose sum equals a target.
- Merge two sorted arrays into a single sorted array.
- Move all zeros in an array to the end.
- Find the length of the longest subarray with a given sum.
- Determine if an array contains a subarray with a sum of zero.
📝 String Problems
- Reverse a string without using extra space.
- Check if a string is a palindrome.
- Find the first non-repeating character in a string.
- Count the frequency of each character in a string.
- Check if two strings are anagrams.
- Implement a basic string compression algorithm.
- Find the longest common prefix among a set of strings.
- Replace all spaces in a string with
%20
.
- Find the longest palindromic substring.
- Print all permutations of a string.
🔁 Recursion Problems
- Compute the factorial of a number.
- Generate the Fibonacci sequence up to
n
.
- Solve the Tower of Hanoi for
n
disks.
- Print all subsets of a given array.
- Find the nth term of a geometric progression using recursion.
- Solve the N-Queens problem for a chessboard of size
n x n
.
- Generate all valid combinations of
n
pairs of parentheses.
- Perform binary search recursively.
- Find the greatest common divisor (GCD) of two numbers using recursion.
- Count the number of ways to climb
n
stairs with steps of 1 or 2.
🔢 Mathematical Problems
- Check if a number is prime.
- Find the sum of all prime numbers up to
n
.
- Determine the number of trailing zeros in the factorial of a number.
- Calculate the sum of digits of a number until it becomes a single digit.
- Solve modular exponentiation efficiently.
- Find all prime factors of a number.
- Check if a number is an Armstrong number.
- Print the first
n
perfect numbers.
- Determine if a number is a palindrome.
- Compute the nth Fibonacci number iteratively.
⚙️ Bit Manipulation Problems
- Check if a number is a power of 2.
- Find the only non-repeated number in an array where every other number repeats twice.
- Count the number of
1
bits in a number.
- Toggle the
k
th bit of a number.
- Find the XOR of all elements in an array.
💡 Projects to Learn Logical Building
- Simple Calculator with all mathematical operations.
- Build a program to generate fractal patterns like the Sierpiński triangle.
- Implement a matrix multiplication program.
- Create a Sudoku solver.
- Develop a program to check plagiarism in documents by comparing substrings.
- Create a maze solver using recursion and backtracking.
- Build a basic file compression algorithm using bit-level operations.
✅ Practice these problems progressively — start with basic patterns and arrays, then move to recursion, bitwise operations, and finally tackle projects for applied logic building.