0% found this document useful (0 votes)
40 views4 pages

Logics

The document lists a comprehensive set of programming tasks and algorithms categorized into sections such as Basic Programs, Working with Numbers, Codes for Recursion, Arrays, Operations on Strings, Advanced, and Codes related to Matrix. Each section contains various problems that can be solved using programming techniques, covering topics like number manipulation, string operations, array handling, and matrix operations. This resource serves as a guide for learners and developers to practice and enhance their coding skills.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
40 views4 pages

Logics

The document lists a comprehensive set of programming tasks and algorithms categorized into sections such as Basic Programs, Working with Numbers, Codes for Recursion, Arrays, Operations on Strings, Advanced, and Codes related to Matrix. Each section contains various problems that can be solved using programming techniques, covering topics like number manipulation, string operations, array handling, and matrix operations. This resource serves as a guide for learners and developers to practice and enhance their coding skills.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Basic Programs

**************
1) Positive or Negative number
2) Even or Odd number
3) Sum of First N Natural numbers
4) Sum of N natural numbers
5) Sum of numbers in a given range
6) Greatest of two numbers
7) Greatest of the Three numbers
8) Leap year or not
9) Prime number
10) Prime number within a given range
11) Sum of digits of a number
12) Reverse of a number
13) Palindrome number
14) Armstrong number
15) Armstrong number in a given range
16) Fibonacci Series upto nth term
17) Find the Nth Term of the Fibonacci Series
18) Factorial of a number
19) Power of a number
20) Factor of a number
21) Finding Prime Factors of a number
22) Strong number
23) Perfect number
24) Perfect Square
25) Automorphic number
26) Harshad number
27) Abundant number

Working with Numbers


********************
28) Highest Common Factor(HCF)
29) Lowest Common Multiple (LCM)
30) Greatest Common Divisor
31) Binary to Decimal to conversion
32) Octal to Decimal conversion
33) Hexadecimal to Decimal conversion
34) Decimal to Binary conversion
35) Decimal to Octal Conversion
36) Decimal to Hexadecimal Conversion
37) Binary to Octal conversion
38) Octal to Binary conversion
39) Quadrants in which a given coordinate lies
40) Permutations in which n people can occupy r seats in a classroom
41) Maximum number of handshakes
42) Addition of two fractions
43) Replace all 0’s with 1 in a given integer
44) Can a number be expressed as a sum of two prime numbers
45) Count possible decoding of a given digit sequence
46) Calculate the area of a circle
47) Find the prime numbers between 1 to 100
48) Calculate the number of digits in an integer
49) Convert digit/number to words
50) Counting number of days in a given month of a year
51) Finding Number of times x digit occurs in a given input
52) Finding number of integers which has exactly x divisors
53) Finding Roots of a quadratic equation

Codes for Recursion


*******************
54) Power of a Number
55) Prime Number
56) Largest element in an array
57) Smallest element in an array
58) Reversing a Number
59) HCF of two numbers
60) LCM of two numbers
61) Program to calculate length of the string using recursion
62) Print All Permutations of a String
63) Given an integer N the task is to print the F(N)th term.
64) Given a list arr of N integers, print sums of all subsets in it
65) Last non-zero digit in factorial
66) Given a positive integer N, return the Nth row of pascal’s triangle
67) Given an integer N representing the number of pairs of parentheses, the task is to generate all
combinations of well-formed(balanced) parentheses
68) Find the Factorial of a number using recursion
69) Find all possible Palindromic partitions of the given String
70) Find all the N bit binary numbers having more than or equal 1’s than 0’s
71) Given a set of positive integers, find all its subsets
72) Given a string s, remove all its adjacent duplicate characters recursively

Arrays
******
73) Find Largest element in an array
74) Find Smallest Element in an Array
75) Find the Smallest and largest element in an array
76) Find Second Smallest Element in an Array
77) Calculate the sum of elements in an array
78) Reverse an Array
79) Sort first half in ascending order and second half in descending
80) Sort the elements of an array
81) Finding the frequency of elements in an array
82) Sorting elements of an array by frequency
83) Finding the Longest Palindrome in an Array
84) Counting Distinct Elements in an Array
85) Finding Repeating elements in an Array
86) Finding Non Repeating elements in an Array
87) Removing Duplicate elements from an array
88) Finding Minimum scalar product of two vectors
89) Finding Maximum scalar product of two vectors in an array
90) Counting the number of even and odd elements in an array
91) Find all Symmetric pairs in an array
92) Find maximum product sub-array in a given array
93) Finding Arrays are disjoint or not
94) Determine Array is a subset of another array or not
95) Determine can all numbers of an array be made equal
96) Finding Minimum sum of absolute difference of given array
97) Sort an array according to the order defined by another array
98) Replace each element of the array by its rank in the array
99) Finding equilibrium index of an array
100) Rotation of elements of array- left and right
101) Block swap algorithm for array rotation
102) Juggling algorithm for array rotation
103) Finding Circular rotation of an array by K positions
104) Balanced Parenthesis Problem

Operations on Strings
*********************
105) Check whether a character is a vowel or consonant
106) Check whether a character is a alphabet or not
107) Find the ASCII value of a character
108) Length of the string without using strlen() function
109) Toggle each character in a string
110) Count the number of vowels
111) Remove the vowels from a String
112) Check if the given string is Palindrome or not
113) Print the given string in reverse order
114) Remove all characters from string except alphabets
115) Remove spaces from a string
116) Remove brackets from an algebraic expression
117) Count the sum of numbers in a string
118) Capitalize the first and last character of each word of a string
119) Calculate frequency of characters in a string
120) Find non-repeating characters in a string
121) Check if two strings are Anagram or not
122) Replace a sub-string in a string
123) Replacing a particular word with another word in a string
124) Count common sub-sequence in two strings
125) Check if two strings match where one string contains wildcard characters
126) Print all permutations of a given string in lexicographically sorted order

Advanced
********
127) Given an array which consists of only 0, 1 and 2. Sort the array without using any
128) Find the “Kth” max and min element of an array
129) Move all the negative elements to one side of the array
130) Find the Union and Intersection of the two sorted arrays.
131) Find Largest sum contiguous Subarray
132) Minimize the maximum difference between heights
133) Minimum no. of Jumps to reach the end of an array
134) Find duplicate in an array of N+1 Integers
135) Merge 2 sorted arrays without using extra space.
136) Kadane’s Algorithm
137) Merge Intervals
138) Count Inversion
139) Best time to buy and Sell stock
140) Find all pairs on integer array whose sum is equal to given number
141) Find if there is any subarray with sum equal to 0
142) Find factorial of a Large Number
143) Find common elements In 3 sorted arrays
144) Rearrange the array in alternating positive and negative items with O(1) extra space
145) Given an array of size n and a number k, find all elements that appear more than ” n/k ” times.
146) Maximum profit by buying and selling a share atmost twice
Next Permutation
147) Find longest consecutive subsequence
148) Trapping Rain water problem
149) Chocolate Distribution problem
150) Smallest Subarray with sum greater than a given value
151) Three way partitioning of an array around a given value
152) Minimum no. of operations required to make an array palindrome
153) Median of 2 sorted arrays of equal size
154) Median of 2 sorted arrays of different size

Codes related to Matrix


*******************
155) Spiral traversal on a Matrix
156) Search an element in a matrix
157) Find median in a row wise sorted matrix
158) Find row with maximum no. of 1’s
159) Print elements in sorted order using row-column wise sorted matrix
160) Find a specific pair in matrix
161) Rotate matrix by 90 degrees
162) Kth smallest element in a row-column wise sorted matrix
163) Common elements in all rows of a given matrix

You might also like