Basic DSA Questions
by:Coder_bhaiyaa
Basic Questions:-
1. Swapping Two Numbers:-
Write a program to swap two numbers without using a temporary
variable.
2. Sorting an Array:-
Write a program to sort an array of integers using the bubble sort
algorithm.
3. Palindrome Check:-
Write a program to check if a given string is a palindrome.
4. Factorial Calculation:-
Write a program to calculate the factorial of a given number using
recursion.
5. Fibonacci Sequence:-
Write a program to generate the first n numbers in the Fibonacci
sequence.
6. Reverse a String:-
Write a program to reverse a given string.
7. Find Maximum and Minimum in Array:-
Write a program to find the maximum and minimum elements in
an array.
8. Check Prime Number:-
Write a program to check if a given number is a prime number.
9. Merge Two Sorted Arrays:-
Write a program to merge two sorted arrays into a single sorted
array.
10. Sum of Digits:-
Write a program to calculate the sum of digits of a given number.
11. Anagram Check:-
Write a program to check if two given strings are anagrams of
each other.
12. Remove Duplicates from Array:-
Write a program to remove duplicate elements from an array.
13. Count Vowels and Consonants:-
Write a program to count the number of vowels and consonants
in a given string.
14. Matrix Transpose:-
Write a program to find the transpose of a given matrix.
15. GCD and LCM:-
Write a program to find the greatest common divisor (GCD) and
least common multiple (LCM) of two numbers.
16. Binary Search:-
Write a program to implement binary search on a sorted array.
17. Find Second Largest Element:-
Write a program to find the second largest element in an array.
18. Armstrong Number:-
Write a program to check if a given number is an Armstrong
number.
19. Print All Permutations:-
Write a program to print all permutations of a given string.
20. Find Intersection of Two Arrays:-
Write a program to find the intersection of two arrays