Top 100 Codes
PrepInsta Top 100 Codes
Below You will find some of the most important codes in languages like C, C++ and Java. These codes are of prime importance for college semester exams and also for various online tests and interviews of the companies offering placements within varying range in LPA.
These codes are very important since these will help you clear your basic concepts in various languages.
Getting Started
- Introduction to Top 100 codes
- ASCII Table
- Positive or Negative number: C | C++ | Java | Python
- Even or Odd number: C | C++ | Java | Python
- Sum of First N Natural numbers: C | C++ | Java | Python
- Sum of N natural numbers: C | C++ | Java | Python
- Sum of numbers in a given range: C | C++ | Java | Python
- Greatest of two numbers: C | C++ | Java | Python
- Greatest of the Three numbers: C | C++ | Java | Python
- Leap year or not: C | C++ | Java | Python
- Prime number: C | C++ | Java | Python
- Prime number within a given range: C | C++ | Java | Python
- Sum of digits of a number: C | C++ | Java | Python
- Reverse of a number : C | C++ | Java | Python
- Palindrome number: C | C++ | Java | Python
- Armstrong number : C | C++ | Java | Python
- Armstrong number in a given range : C | C++ | Java | Python
- Fibonacci Series upto nth term : C | C++ | Java | Python
- Find the Nth Term of the Fibonacci Series : C | C++ | Java | Python
- Factorial of a number : C | C++ | Java | Python
- Power of a number : C | C++ | Java | Python
- Factor of a number : C | C++ | Java | Python
- Finding Prime Factors of a number : C | C++ | Java | Python
- Strong number : C | C++ | Java | Python
- Perfect number : C | C++ | Java | Python
- Perfect Square : C | C++ | Java | Python
- Automorphic number : C | C++ | Java | Python
- Harshad number : C | C++ | Java | Python
- Abundant number : C| C++ | Java | Python
- Friendly pair : C | C++ | Java | Python
Working with Numbers
- Highest Common Factor(HCF): C | C++ | Java | Python
- Lowest Common Multiple (LCM) : C | C++ | Java | Python
- Greatest Common Divisor : C | C++ | Java | Python
- Binary to Decimal to conversion : C | C++ | Java | Python
- Octal to Decimal conversion : C | C++ | Java | Python
- Hexadecimal to Decimal conversion: C | C++ | Java | Python
- Decimal to Binary conversion: C | C++ | Java | Python
- Decimal to Octal Conversion: C | C++ | Java | Python
- Decimal to Hexadecimal Conversion: C | C++ | Java | Python
- Binary to Octal conversion : C | C++ | Java | Python
- Octal to Binary conversion : C | C++ | Java | Python
- Quadrants in which a given coordinate lies : C | C++ | Java | Python
- Permutations in which n people can occupy r seats in a classroom : C | C++ | Java | Python
- Maximum number of handshakes: C | C++ | Java | Python
- Addition of two fractions: C | C++ | Java | Python
- Replace all 0’s with 1 in a given integer : C | C++ | Java | Python
- Can a number be expressed as a sum of two prime numbers : C | C++ | Java | Python
- Count possible decoding of a given digit sequence : C | C++ | Java | Python
- Calculate the area of a circle : C | C++ | Java | Python
- Find the prime numbers between 1 to 100 : C | C++ | Java | Python
- Calculate the number of digits in an integer : C | C++ | Java | Python
- Convert digit/number to words : C | C++ | Java | Python
- Counting number of days in a given month of a year: C | C++ | Java | Python
- Finding Number of times x digit occurs in a given input : C | C++ | Java | Python
- Finding number of integers which has exactly x divisors: C | C++ | Java | Python
- Finding Roots of a quadratic equation : C | C++ | Java | Python
Codes for Recursion
- Power of a Number – C | C++ | Java | Python
- Prime Number – C | C++ | Java | Python
- Largest element in an array – C | C++ | Java | Python
- Smallest element in an array – C | C++ | Java | Python
- Reversing a Number – C | C++ | Java | Python
- HCF of two numbers – C | C++ | Java | Python
- LCM of two numbers – C | C++ | Java | Python
- Program to calculate length of the string using recursion- C | C++ | Java | Python
- Print All Permutations of a String- C | C++ | Java | Python
- Given an integer N the task is to print the F(N)th term.- C | C++ | Java | Python
- Given a list arr of N integers, print sums of all subsets in it- C | C++ | Java | Python
- Last non-zero digit in factorial- C | C++ | Java | Python
- Given a positive integer N, return the Nth row of pascal’s triangle – C | C++ | Java | Python
- Given an integer N representing the number of pairs of parentheses, the task is to generate all combinations of well-formed(balanced) parentheses – C | C++ | Java | Python
- Find the Factorial of a number using recursion – C | C++ | Java | Python
- Find all possible Palindromic partitions of the given String – C | C++ | Java | Python
- Find all the N bit binary numbers having more than or equal 1’s than 0’s – C | C++ | Java | Python
- Given a set of positive integers, find all its subsets – C | C++ | Java | Python
- Given a string s, remove all its adjacent duplicate characters recursively – C | C++ | Java | Python
Important Codes related to Arrays
- Find Largest element in an array : C | C++ | Java | Python
- Find Smallest Element in an Array : C | C++ | Java | Python
- Find the Smallest and largest element in an array : C | C++ | Java | Python
- Find Second Smallest Element in an Array : C | C++ | Java | Python
- Calculate the sum of elements in an array : C | C++ | Java | Python
- Reverse an Array : C | C++ | Java | Python
- Sort first half in ascending order and second half in descending : C | C++ | Java | Python
- Sort the elements of an array : C | C++ | Java | Python
- Finding the frequency of elements in an array : C | C++ | Java | Python
- Sorting elements of an array by frequency : C | C++ | Java | Python
- Finding the Longest Palindrome in an Array : C | C++ | Java| Python
- Counting Distinct Elements in an Array : C | C++ | Java| Python
- Finding Repeating elements in an Array : C | C++ | Java | Python
- Finding Non Repeating elements in an Array : C | C++ | Java | Python
- Removing Duplicate elements from an array : C | C++ | Java | Python
- Finding Minimum scalar product of two vectors : C | C++ | Java | Python
- Finding Maximum scalar product of two vectors in an array : C | C++ | Java | Python
- Counting the number of even and odd elements in an array : C | C++ | Java | Python
- Find all Symmetric pairs in an array : C | C++ | Java | Python
- Find maximum product sub-array in a given array : C | C++ | Java | Python
- Finding Arrays are disjoint or not : C | C++ | Java | Python
- Determine Array is a subset of another array or not : C | C++ | Java | Python
- Determine can all numbers of an array be made equal : C | C++ | Java | Python
- Finding Minimum sum of absolute difference of given array : C | C++ | Java | Python
- Sort an array according to the order defined by another array : C | C++ | Java | Python
- Replace each element of the array by its rank in the array : C | C++ | Java | Python
- Finding equilibrium index of an array : C | C++ | Java| Python
- Rotation of elements of array- left and right : C | C++ | Java| Python
- Block swap algorithm for array rotation : C | C++ | Java| Python
- Juggling algorithm for array rotation : C | C++ | Java | Python
- Finding Circular rotation of an array by K positions : C | C++ | Java | Python
- Balanced Parenthesis Problem : C | C++ | Java | Python
Operations on Strings
- Check whether a character is a vowel or consonant : C | C++ | Java | Python
- Check whether a character is a alphabet or not : C | C++ | Java | Python
- Find the ASCII value of a character : C | C++ | Java | Python
- Length of the string without using strlen() function : C | C++ | Java | Python
- Toggle each character in a string : C | C++ | Java | Python
- Count the number of vowels : C | C++ | Java | Python
- Remove the vowels from a String : C | C++ | Java | Python
- Check if the given string is Palindrome or not : C | C++ | Java | Python
- Print the given string in reverse order : C | C++ | Java | Python
- Remove all characters from string except alphabets : C | C++ | Java | Python
- Remove spaces from a string : C | C++ | Java | Python
- Remove brackets from an algebraic expression : C | C++ | Java | Python
- Count the sum of numbers in a string : C | C++ | Java | Python
- Capitalize the first and last character of each word of a string : C | C++ | Java | Python
- Calculate frequency of characters in a string : C | C++ | Java | Python
- Find non-repeating characters in a string : C | C++ | JAVA | Python
- Check if two strings are Anagram or not : C | C++ | Java | Python
- Replace a sub-string in a string: C | C++ | Java | Python
- Replacing a particular word with another word in a string – C | C++ | Java | Python
- Count common sub-sequence in two strings : C | C++ | Java | Python
- Check if two strings match where one string contains wildcard characters : C | C++ | Java | Python
- Print all permutations of a given string in lexicographically sorted order : C | C++ | Java | Python
Advanced Codes related to Arrays
- Given an array which consists of only 0, 1 and 2. Sort the array without using any algorithm – C | C++ | Java | Python
- Find the “Kth” max and min element of an array – C | C++ | Java | Python
- Move all the negative elements to one side of the array – C | C++ | Java | Python
- Find the Union and Intersection of the two sorted arrays. – C | C++ | Java | Python
- Find Largest sum contiguous Subarray – C | C++ | Java | Python
- Minimize the maximum difference between heights – C | C++ | Java | Python
- Minimum no. of Jumps to reach the end of an array – C | C++ | Java | Python
- Find duplicate in an array of N+1 Integers – C | C++ | Java | Python
- Merge 2 sorted arrays without using extra space. – C | C++ | Java | Python
- Kadane’s Algorithm – C | C++ | Java | Python
- Merge Intervals – C | C++ | Java | Python
- Count Inversion – C | C++ | Java | Python
- Best time to buy and Sell stock – C | C++ | Java | Python
- Find all pairs on integer array whose sum is equal to given number – C | C++ | Java | Python
- Find if there is any subarray with sum equal to 0 – C | C++ | Java | Python
- Find factorial of a Large Number – C | C++ | Java | Python
- Find common elements In 3 sorted arrays – C | C++ | Java | Python
- Rearrange the array in alternating positive and negative items with O(1) extra space – C | C++ | Java | Python
- Given an array of size n and a number k, find all elements that appear more than ” n/k ” times. – C | C++ | Java | Python
- Maximum profit by buying and selling a share atmost twice – C | C++ | Java | Python
- Next Permutation – C | C++ | Java | Python
- Find longest consecutive subsequence – C | C++ | Java | Python
- Trapping Rain water problem – C | C++ | Java | Python
- Chocolate Distribution problem – C | C++ | Java | Python
- Smallest Subarray with sum greater than a given value – C | C++ | Java | Python
- Three way partitioning of an array around a given value – C | C++ | Java | Python
- Minimum no. of operations required to make an array palindrome – C | C++ | Java | Python
- Median of 2 sorted arrays of equal size – C | C++ | Java | Python
- Median of 2 sorted arrays of different size – C | C++ | Java | Python
Codes related to Matrix
- Spiral traversal on a Matrix – C | C++ | Java | Python
- Search an element in a matrix – C | C++ | Java | Python
- Find median in a row wise sorted matrix – C | C++ | Java | Python
- Find row with maximum no. of 1’s – C | C++ | Java | Python
- Print elements in sorted order using row-column wise sorted matrix – C | C++ | Java | Python
- Find a specific pair in matrix – C | C++ | Java | Python
- Rotate matrix by 90 degrees – C | C++ | Java | Python
- Kth smallest element in a row-column wise sorted matrix – C | C++ | Java | Python
- Common elements in all rows of a given matrix – C | C++ | Java | Python
Pattern Printing
Number Pattern Printing Programs
Number Star Mix Pattern
Few more pattern programs
- Program for Pyramid star pattern
- Program for Pyramid number pattern
- Program for Palindromic Pyramid Pattern – Java | Python
- Program for Diamond star pattern
- Program for Diamond number pattern
- Program for Floyd’s Trianlge – Java | Python
- Program for Pascal triangle – Java | Python
- Program to Check array similarity
- Program for Square sum
- Program for Longest palindrome in the array
Sir or Mam how can built logic to solve these question ? Please explain it
Hey, we recommend you to practice as much coding questions as you can, this will help you out to develop logic.💕
super website to attend the questions .Thank you for giving this platform to all.
Hey there,
Thanks for your feedback, it means alot.
Hi sir iam in 3rd year i can’t know how to prepare for placenta can you please help me how to prepare for placements
Hey there, Kindly message us at Whatsapp number 8448440710, Our expert mentors will guide you further precisely🙌.
Will these questions be enough to crack service base companies?
Hi Aishika,
These questions will be enough but you can still practice dedicated company based Coding Questions.
Yes
❤❤
Will these questions be enough to crack product base companies?
Hi Aishika,
Yes these questions will be enough but we will advice to practice Intermediate Coding Questions as well.
hii can i ask few questions
Hey there, Thanks for commenting and feel free to ask your queries🙌
Nice
Will these questions be enough to crack 8+LPA companies.
Yes, these are good enough. But for packages > 6LPA also do DSA, you can refer https://prepinsta.com/data-structures/
Civil war 1 code
Hi Sir,Now I am in 3rd year still I don’t know how to get a placement.Can you please help me to get a placement.
Hey there, Don’t worry. We are right here to help you. Kindly cal us on 8448440710 or text us on 8287659510 for guidance. Our team would be more than glad to help you.
I think these are enough to crack coding round, thankyou prepinsta
We are glad to see that ❤