Competitive Programming
Competitive Programming
DEPARTMENT OF
COMPUTER SCIENCE AND ENGINEERING
COMPETITIVE PROGRAMMING
A. Basic C Programs on Control Statements (Looping)
1. A character is a vowel or consonant
2. A character is an alphabet or not
3. Ascii values of a character
4. Uppercase, Lowercase or special character
5. A number is positive or negative
6. A number is even or odd
7. Swap two numbers without third variable
8. Area of a circle
9. LCM of two numbers
10. GCD of two numbers
11. Greatest of two numbers
12. Greatest of three numbers
13. Number of digits in an integer
14. Sum of digits of a number
15. Sum of N natural numbers
16. Sum of numbers in a given range
17. Reverse a given number
18. Factorial of a number
19. Fibonacci series up ton
20. Leap year or not
21. Prime number or not
22. Palindrome or not
23. Armstrong number or not
24. Strong number or not
25. Perfect number or not
26. Friendly pair or not (amicable or not)
27. Automorphic number or not
28. Harshad number or not
29. Abundant number or not
30. Power of a number
31. Factors of a number
32. Add two fractions
B. Basic C Programs on Control Statements (Looping)
1. Prime numbers in a given range
2. Armstrong numbers between two intervals
3. Can a number be expressed as a sum of two prime numbers?
4. Replace all 0's with 1 in a given integer
5. Binary to decimal conversion
6. Decimal to binary conversion
7. Decimal to octal conversion
8. Octal to decimal conversion
9. Binary to octal conversion
10. Octal to binary conversion
11. Maximum number of handshakes
12. Quadrants in which coordinates lie
13. Convert digit/number to words
14. Number of days in a given month of a given year
15. Permutations in which n people can occupy r seats in a theatre
16. Number of times digit 3 occurs in each and every number from 0 to n
17. Number of integers which has exactly 9 divisors
18. Roots of a quadratic equation
19. Count possible decodings of a given digit sequence
C. Basic Pattern printing Programs
1. Solid and hollow rectangle star pattern
2. Pyramid pattern using stars
3. Pyramid pattern using numbers
4. Palindromic pyramid pattern printing
5. Diamond pattern printing using stars
6. Diamond pattern printing using numbers
7. Floyd's triangle
8. Pascal triangle
9. All other pattern programs
D. Programs on Strings
1. Basic string operations
2. Length of the string without using strlen() function
3. Toggle each character in a string
4. Count the number of vowels
5. Remove vowels from a string
6. String is a palindrome or not
7. Sorting a string in alphabetical order
8. Removing brackets from an algebraic expression
9. Remove characters in a string except alphabets
10. Remove spaces from a string
11. Count the sum of numbers in a string
12. Capitalize the first and last letter of each word of a string
13. Frequency of characters in a string
14. Non-repeating characters in a string
15. Check if two strings are Anagram or not
16. Patterns of 0(1+)0 in the given string
17. Replace substring in a string
18. Count common subsequence in two strings
19. Reverse a string
20. Check if two strings match where one string contains wildcard characters
E. Arrays C Programs
1-D Arrays
1. Basic array operations (Insert, delete and search an element)
2. Smallest and largest element in an array
3. Sum of elements in an array
4. Check if two arrays are the same or not
5. Finding the array type
6. Sum of positive square elements in an array
7. Second smallest element in an array
8. Sorting the elements of an array
9. Reversing an array
10. Longest palindrome in an array
11. Count distinct elements of an array
12. Non-repeating elements of an array
13. Repeating elements in an array
14. Remove duplicate elements in an array
15. Minimum scalar product of two vectors
16. Maximum scalar product of two vectors
17. Can the numbers of an array be made equal?
18. Missing elements of a range
19. Triplets with a given sum
20. Number of even and odd elements in an array
21. Frequency of each element of an array
22. Symmetric pairs in an array
23. Maximum product subarray in a given array
24. Arrays are disjoint or not
25. Array is a subset of another array or not
26. Can all numbers of an array be made equal
27. Minimum sum of absolute difference of given array
28. Sorting elements of an array by frequency
29. Sort an array according to the order defined by another array
30. Replace each element of the array by its rank in the array
31. Equilibrium index of an array
32. Array rotation - Left and right
33. Block swap algorithm for array rotation
34. Juggling algorithm for array rotation
35. Circular rotation of an array by K positions
36. Convert an array into a zig-zag fashion
37. Merge two sorted arrays
38. Longest subarray having an average greater than or equal to k
39. Rearrange positive and negative numbers in an array
40. Sum of all odd frequency elements in an array
41. Median of two sorted arrays
42. 42. 0-1 Knapsack problem
2-D Arrays
1. Matrix operations (Addition, subtraction and multiplication)
2. Transpose of a matrix
3. Upper triangular matrix or not
4. Lower triangular matrix or not
5. The maximum element in a row
6. The maximum element in a column
7. Sum of each row and column of a matrix
8. Saddle point coordinates of a given matrix
9. Sum of elements in the zig-zag sequence of a matrix
10. Sum of boundary elements of a matrix
11. Matrix printing in aspiral form
12. Rotate the matrix by K times
13. Matrix rotation by 90 degrees clockwise and anticlockwise
14. Maximum size of square submatrix with all 1s in a binary matrix