Sam007
Sam007
  1. Print all the duplicates in the input string
  2. Program to find whether a no is power of two
  3. Ugly Numbers
  4. Minimum number of jumps to reach end
  5. Count set bits in an integer
  6. Given a string, find its first non-repeating character
  7. Write a program to reverse an array or string
  8. Count Inversions in an array | Set 1 (Using Merge Sort)
  9. Two elements whose sum is closest to zero
  10. Maximum difference between two elements such that larger element appears after the smaller number
  11. Cutting a Rod | DP-13
  12. Next Greater Element
  13. Find duplicates in O(n) time and O(1) extra space | Set 1
  14. Naive algorithm for Pattern Searching
  15. Count number of occurrences (or frequency) in a sorted array
  16. Given an array arr[], find the maximum j - i such that arr[j] > arr[i]
  17. Find whether an array is subset of another array | Added Method 3
  18. Find the minimum distance between two numbers
  19. Smallest of three integers without comparison operators
  20. Min Cost Path | DP-6
  21. Find a Fixed Point (Value equal to index) in a given array
  22. Count smaller elements on right side
  23. Coin Change | DP-7
  24. 0-1 Knapsack Problem | DP-10
  25. Egg Dropping Puzzle | DP-11
  26. Maximum Sum Increasing Subsequence | DP-14
  27. Chinese Remainder Theorem | Set 1 (Introduction)
  28. Shuffle a given array using Fisher–Yates shuffle Algorithm
  29. The Stock Span Problem
  30. Minimum insertions to form a palindrome | DP-28
  31. Unbounded Binary Search Example (Find the point where a monotonically increasing function becomes positive first time)
  32. Find if there is a subarray with 0 sum
  33. Printing Longest Common Subsequence
  34. Create a matrix with alternating rectangles of O and X
  35. Rearrange array in alternating positive & negative items with O(1) extra space | Set 1
  36. Find the smallest positive integer value that cannot be represented as sum of any subset of a given array
  37. Find common elements in three sorted arrays
  38. Given an n x n square matrix, find sum of all sub-squares of size k x k
  39. Find n'th number in a number system with only 3 and 4
  40. Length of the largest subarray with contiguous elements | Set 1
  41. Length of the largest subarray with contiguous elements | Set 2
  42. Find minimum time to finish all jobs with given constraints
  43. Count Distinct Non-Negative Integer Pairs (x, y) that Satisfy the Inequality x*x + y*y < n
  44. Find if a given string can be represented from a substring by iterating the substring “n” times
  45. Find a common element in all rows of a given row-wise sorted matrix
  46. Count number of islands where every island is row-wise and column-wise separated
  47. Find the minimum cost to reach destination using a train
  48. How to print maximum number of A's using given four keys
  49. Calculate square of a number without using *, / and pow()
  50. Check if a given sequence of moves for a robot is circular or not
  51. Calculate 7n/8 without using division and multiplication operators
  52. Legendre's formula (Given p and n, find the largest x such that p^x divides n!)
  53. Euler's Totient Function
  54. Count numbers from 1 to n that have 4 as a digit
  55. Shortest Common Supersequence
  56. Find nth Magic Number
  57. Minimum steps to reach a destination
  58. Find the odd appearing element in O(Log n) time
  59. Search an element in an array where difference between adjacent elements is 1
  60. Count factorial numbers in a given range
  61. Total number of non-decreasing numbers with n digits
  62. Check if a given number is sparse or not
  63. Find maximum of minimum for every window size in a given array
  64. Maximum weight transformation of a given string
  65. Check if two given strings are isomorphic to each other
  66. Count number of ways to cover a distance
  67. Find the maximum subarray XOR in a given array
  68. Euler's Totient function for all numbers smaller than or equal to n
  69. Check if edit distance between two strings is one
  70. Euler's criterion (Check if square root under modulo p exists)
  71. Program for Method Of False Position
  72. Count Fibonacci numbers in given range in O(Log n) time and O(1) space
  73. Find smallest values of x and y such that ax - by = 0
  74. Find the maximum subset XOR of a given set
  75. Check if count of divisors is even or odd
  76. Rearrange an array in maximum minimum form | Set 1
  77. Submatrix Sum Queries
  78. Runge-Kutta 4th Order Method to Solve Differential Equation
  79. Subarray/Substring vs Subsequence and Programs to Generate them
  80. Count numbers having 0 as a digit
  81. Frobenius coin problem
  82. Comb Sort
  83. Pigeonhole Sort
  84. Number of perfect squares between two given numbers
  85. Count number of ways to fill a "n x 4" grid using "1 x 4" tiles
  86. Count positive integers with 0 as a digit and maximum 'd' digits
  87. Count Negative Numbers in a Column-Wise and Row-Wise Sorted Matrix
  88. Check perfect square using addition/subtraction
  89. Check if a number is a power of another number
  90. Fifth root of a number
  91. Minimum number of palindromic subsequences to be removed to empty a binary string
  92. Odd-Even Sort / Brick Sort
  93. Maximum profit by buying and selling a share at most k times
  94. Pair with given product | Set 1 (Find if any pair exists)
  95. No of Factors of n!
  96. Cocktail Sort
  97. Gnome Sort
  98. Count zeros in a row wise and column wise sorted matrix
  99. Find minimum adjustment cost of an array
  100. Program to find last digit of n'th Fibonnaci Number
  101. Print all n-digit strictly increasing numbers
  102. Change if all bits can be made same by single flip
  103. Swap three variables without using temporary variable
  104. Find minimum sum such that one of every three consecutive elements is taken
  105. Least prime factor of numbers till n
  106. Bakhshali Approximation for computing square roots
  107. n'th multiple of a number in Fibonacci Series
  108. Group all occurrences of characters according to first appearance
  109. Elements before which no element is bigger in array
  110. Sum of average of all subsets
  111. Minimum XOR Value Pair
  112. Count pairs in an array that hold i*arr[i] > j*arr[j]
  113. Find (a^b)%m where 'a' is very large
  114. Generate all palindromic numbers less than n
  115. Count of character pairs at same distance as in English alphabets
  116. Probability of Knight to remain in the chessboard
  117. Check whether Arithmetic Progression can be formed from the given array
  118. Recursive Bubble Sort
  119. Largest subarray with GCD one
  120. Lexicographically smallest array after at-most K consecutive swaps
  121. Find floor and ceil in an unsorted array
  122. Recursive Insertion Sort
  123. Rotate a matrix by 90 degree without using any extra space | Set 2
  124. Given two unsorted arrays, find all pairs whose sum is x
  125. Fill an array based on frequency where elements are in range from 0 to n-1
  126. XOR of all subarray XORs | Set 1
  127. Stooge Sort
  128. Program for Conway's Game Of Life
  129. Find number of endless points
  130. Multiples of 3 and 5 without using % operator
  131. Number of even substrings in a string of digits
  132. Place k elements such that minimum distance is maximized
  133. Meta Strings (Check if two strings can become same after a swap in one string)
  134. Count the number of subarrays having a given XOR
  135. Minimum toggles to partition a binary array so that it has first 0s then 1s
  136. Digital Root (repeated digital sum) of the given large integer
  137. Construct an array from its pair-sum array
  138. Program to find number of squares in a chessboard
  139. Reverse an array upto a given position
  140. Print first k digits of 1/n where n is a positive integer
  141. Efficient Program to Compute Sum of Series 1/1! + 1/2! + 1/3! + 1/4! + .. + 1/n!
  142. Print All Distinct Elements of a given integer array
  143. Program to find remainder without using modulo or % operator
  144. Count 1's in a sorted binary array
  145. Given a number n, count all multiples of 3 and/or 5 in set {1, 2, 3, ... n}
  146. Replace every array element by multiplication of previous and next
  147. How to compute mod of a big number?
  148. Program to check if a given number is Lucky (all digits are different)
  149. Check if a given number can be represented in given a no. of digits in any base
  150. Program to print Sum Triangle for a given array
  151. Program to add two binary strings
  152. Add two numbers using ++ and/or --
  153. Prefix Sum Array - Implementation and Applications in Competitive Programming
  154. Program to find the largest and smallest ASCII valued characters in a string
  155. Pandigital number in a given base
  156. First digit in product of an array of numbers
  157. Save from Bishop in chessboard
  158. Maximum value of an integer for which factorial can be calculated on a machine
  159. Find the minimum and maximum amount to buy all N candies
  160. Rearrange an array such that every odd indexed element is greater than it previous
  161. Find the occurrences of digit d in the range [0..n]
  162. Largest Subset with GCD 1
  163. For each element in 1st array count elements less than or equal to it in 2nd array
  164. Program to count occurrence of a given character in a string
  165. Put spaces between words starting with capital letters
  166. Sum of all substrings of a string representing a number | Set 2 (Constant Extra Space)
  167. Minimum sum of two elements from two arrays such that indexes are not same
  168. Number of elements less than or equal to a given number in a given subarray | Set 2 (Including Updates)
  169. Split numeric, alphabetic and special symbols from a String
  170. Reverse a string preserving space positions
  171. Counts paths from a point to reach Origin
  172. Numbers having Unique (or Distinct) digits
  173. Sum of minimum absolute difference of each array element
  174. Count elements less than or equal to a given value in a sorted rotated array
  175. Longest Common Prefix using Sorting
  176. Count total divisors of A or B in a given range
  177. Maximum modulo of all the pairs of array where arr[i] >= arr[j]
  178. Check if a number N starts with 1 in b-base
  179. Find the transition point in a binary array
  180. Program to print Sum of even and odd elements in an array
  181. Check if a number can be written as a sum of 'k' prime numbers
  182. Check whether a given array is a k sorted array or not
  183. Minimum steps to come back to starting point in a circular tour
  184. Search an element in an unsorted array using minimum number of comparisons
  185. Number of pairs in an array such that product is greater than sum
  186. Find if a number is divisible by every number in a list
  187. Represent a given set of points by the best possible straight line
  188. Finding n-th number made of prime digits (2, 3, 5 and 7) only
  189. Find number of diagonals in n sided convex polygon
  190. Find all pairs (a, b) in an array such that a % b = k
  191. Check if a binary string has a 0 between 1s or not | Set 1 (General approach)
  192. Number of n-digits non-decreasing integers
  193. Find maximum possible stolen value from houses
  194. Check if a string is Isogram or not
  195. Fibonacci number in an array
  196. Count the numbers divisible by 'M' in a given range
  197. Count number of triplets with product equal to given number
  198. Sum of product of all elements of sub-arrays of size k
  199. Count of subarrays whose products don't have any repeating prime factor
  200. Print the string by ignoring alternate occurrences of any character
  201. Program for Decimal to Binary Conversion
  202. Number of substrings divisible by 4 in a string of integers
  203. Calculate the difficulty of a sentence
  204. Unset bits in the given range
  205. Queries for counts of array elements with values in given range
  206. Min flips of continuous characters to make all characters same in a string
  207. Climb n-th stair with all jumps from 1 to n allowed (Three Different Approaches)
  208. Check if array elements are consecutive in O(n) time and O(1) space (Handles Both Positive and negative numbers)
  209. Program to check if a matrix is symmetric
  210. Find coordinates of a prime number in a Prime Spiral
  211. Smallest sum contiguous subarray
  212. Print the following pyramid pattern
  213. Rearrange an array in order - smallest, largest, 2nd smallest, 2nd largest, ..
  214. Program that receives a number and prints it out in large size
  215. Sort first half in ascending and second half in descending order | 1
  216. Find element in a sorted array whose frequency is greater than or equal to n/2.
  217. Check if a destination is reachable from source with two movements allowed
  218. Number of digits in the product of two numbers
  219. 1 to n bit numbers with no consecutive 1s in binary representation
  220. Neon Number
  221. Program to check if three points are collinear
  222. Number of bitonic arrays of length n and consisting of elements from 1 to n
  223. Count even and odd digits in an Integer
  224. Toggle all bits after most significant bit
  225. Find row number of a binary matrix having maximum number of 1s
  226. Check if a number has two adjacent set bits
  227. Check if a number is power of 8 or not
  228. Find n-th element in a series with only 2 digits (4 and 7) allowed | Set 2 (log(n) method)
  229. Check if sums of i-th row and i-th column are same in matrix
  230. Find smallest number n such that n XOR n+1 equals to given k.
  231. Check Whether a number is Duck Number or not
  232. Find the sum of maximum difference possible from all subset of a given array.
  233. Sum of upper triangle and lower triangle
  234. Efficiently merging two sorted arrays with O(1) extra space
  235. Find if two people ever meet after same number of jumps
  236. Find most significant set bit of a number
  237. Count total bits in a number
  238. Counting pairs when a person can form pair with at most one
  239. Program to find sum of first n natural numbers
  240. Check if a line touches or intersects a circle
  241. Check whether a number can be expressed as a product of single digit numbers
  242. Minimum operations to make XOR of array zero
  243. Set all the bits in given range of a number
  244. Smallest number divisible by n and has at-least k trailing zeros
  245. Sort a binary array using one traversal
  246. Find position of the given number among the numbers made of 4 and 7
  247. Program to find the initials of a name.
  248. Maximum difference between group of k-elements and rest of the array.
  249. Number of subarrays having product less than K
  250. Sum of all numbers divisible by 6 in a given range
  251. Program to find simple interest
  252. Sum of the series 1 + (1+3) + (1+3+5) + (1+3+5+7) + …… + (1+3+5+7+…+(2n-1))
  253. GCD of digits of a given number
  254. Number of subarrays whose minimum and maximum are same
  255. Possibility of a word from a given set of characters
  256. Least Common Denominator (LCD)
  257. Shuffle array {a1, a2, .. an, b1, b2, .. bn} as {a1, b1, a2, b2, a3, b3, ……, an, bn} without using extra space
  258. Check if a number is divisible by all prime divisors of another number
  259. Mean and Median of a matrix
  260. Minimum reduce operations to convert a given string into a palindrome
  261. Median after K additional integers
  262. Program for product of array
  263. String with k distinct characters and no same characters adjacent
  264. Sum of multiples of a number up to N
  265. Mirror characters of a string
  266. Find the number of spectators standing in the stadium at time t
  267. Decode a median string to the original string
  268. Co-prime pair with given sum minimum difference
  269. Expectation or expected value of an array
  270. Counting cross lines in an array
  271. Number of n digit numbers that do not contain 9
  272. Remove all characters other than alphabets from string
  273. Elements to be added so that all elements of a range are present in array
  274. Number of visible boxes after putting one inside another
  275. Find if given number is sum of first n natural numbers
  276. Minimum cost to convert string into palindrome
  277. Merging elements of two different arrays alternatively in third array
  278. Check input character is alphabet, digit or special character
  279. Check whether a number can be represented by sum of two squares
  280. Longest sequence of positive integers in an array
  281. Count sub-arrays which have elements less than or equal to X
  282. Swap three numbers in cycle
  283. Convert to number with digits as 3 and 8 only
  284. Check if a large number is divisible by 13 or not
  285. Largest number with binary representation is m 1's and m-1 0's
  286. Circular array
  287. Leyland Number
  288. Position of robot after given movements
  289. Check whether the two numbers differ at one bit position only
  290. Program for Fahrenheit to Kelvin conversion
  291. Check whether the bit at given position is set or unset
  292. Longest subsequence where each character occurs at least k times
  293. Perfect Square String
  294. First uppercase letter in a string (Iterative and Recursive)
  295. Count of different ways to express N as the sum of 1, 3 and 4
  296. String from prefix and suffix of given two strings
  297. Ropes left after every removal of smallest
  298. Smallest subarray with product divisible by k
  299. Sum of all subsequences of a number
  300. Minimum total cost incurred to reach the last station
  301. Find the missing integer in an array if mean is given
  302. Divide two integers without using multiplication, division and mod operator
  303. Minimum distance between two occurrences of maximum
  304. Program to print the pattern "GFG"
  305. Check if the array is beautiful
  306. Minimum Swaps required to group all 1's together
  307. Sum of even numbers at even position
  308. Check if a given number is Pronic | Efficient Approach
  309. Sum over Subsets | Dynamic Programming
  310. Program to find all types of Matrix
  311. Product of nodes at k-th level in a tree represented as string
  312. Number is divisible by 29 or not
  313. Print all triplets in sorted array that form AP
  314. Print uncommon elements from two sorted arrays
  315. Sort 1 to N by swapping adjacent elements
  316. Find product of prime numbers between 1 to n
  317. Center element of matrix equals sums of half diagonals
  318. Fibonacci Cube Graph
  319. Number of loops of size k starting from a specific node
  320. Equalizing array using increment under modulo 3
  321. Find largest d in array such that a + b + c = d
  322. Number of subarrays having sum less than K
  323. Reaching a point using clockwise or anticlockwise movements
  324. Program to print reciprocal of letters
  325. Given equation of a circle as string, find area
  326. Maximum elements that can be made equal with k updates
  327. k-Rough Number or k-Jagged Number
  328. First N natural can be divided into two sets with given difference and co-prime sums
  329. Check a number is odd or even without modulus operator
  330. Repeated Unit Divisibility
  331. Sum of range in a series of first odd then even natural numbers
  332. Pattern to print X in a rectangular box
  333. Check if all occurrences of a character appear together
  334. Sub array sum is prime or not
  335. Number of ways an array can be filled with 0s and 1s such that no consecutive elements are 1
  336. Count of 'GFG' Subsequences in the given string
  337. Sum of bitwise OR of all possible subsets of given set
  338. Program to print Reverse Floyd's triangle
  339. Maximum points of intersection n circles
  340. Print prime numbers from 1 to N in reverse order
  341. Previous number same as 1's complement
  342. Replace two consecutive equal values with one greater
  343. Maximize a value for a semicircle of given radius
  344. Sorting array with reverse around middle
  345. Queries on sum of odd number digit sums of all the factors of a number
  346. Segregate even and odd numbers | Set 3
  347. Check if a number can be expressed as power | Set 2 (Using Log)