shrikanth13
shrikanth13
  1. Majority Element
  2. Find the node with minimum value in a Binary Search Tree
  3. Write a program to Calculate Size of a tree | Recursion
  4. Write Code to Determine if Two Trees are Identical
  5. Write a program to Delete a Tree
  6. Convert a Binary Tree into its Mirror Tree
  7. Minimum number of jumps to reach end
  8. Given a binary tree, print out all of its root-to-leaf paths one per line.
  9. Lowest Common Ancestor in a Binary Search Tree.
  10. Merge an array of size n into another array of size m+n
  11. Given a string, find its first non-repeating character
  12. Check sum of Covered and Uncovered nodes of Binary Tree
  13. Compute the minimum or maximum of two integers without branching
  14. Level Order Tree Traversal
  15. Program to count leaf nodes in a binary tree
  16. A program to check if a binary tree is BST or not
  17. Level order traversal in spiral form
  18. Check for Children Sum Property in a Binary Tree
  19. Convert an arbitrary Binary Tree to a tree that holds Children Sum Property
  20. How to determine if a binary tree is height-balanced?
  21. Segregate 0s and 1s in an array
  22. Inorder Tree Traversal without Recursion
  23. Root to leaf path sum equal to a given number
  24. Construct Tree from given Inorder and Preorder traversals
  25. Given a binary tree, print all root-to-leaf paths
  26. Find the largest BST subtree in a given Binary Tree | Set 1
  27. Maximum width of a binary tree
  28. Next Greater Element
  29. Print nodes at k distance from root
  30. Connect nodes at same level
  31. Get Level of a node in a Binary Tree
  32. Print BST keys in the given range
  33. Print Ancestors of a given node in Binary Tree
  34. Find whether an array is subset of another array | Added Method 3
  35. Floor and Ceil from a BST
  36. Connect nodes at same level using constant extra space
  37. Sorted Array to Balanced BST
  38. Implement two stacks in an array
  39. Check whether two strings are anagram of each other
  40. Convert a given tree to its Sum Tree
  41. Merge Two Balanced Binary Search Trees
  42. Find the maximum sum leaf to root path in a Binary Tree
  43. Finite Automata algorithm for Pattern Searching
  44. Largest subarray with equal number of 0s and 1s
  45. Construct Special Binary Tree from given Inorder traversal
  46. Construct a special tree from given preorder traversal
  47. Boundary Traversal of binary tree
  48. Find the row with maximum number of 1s
  49. Print unique rows in a given boolean matrix
  50. Construct Full Binary Tree from given preorder and postorder traversals
  51. Construct BST from given preorder traversal | Set 1
  52. Construct BST from given preorder traversal | Set 2
  53. Longest Palindromic Substring | Set 2
  54. Iterative Preorder Traversal
  55. Convert a BST to a Binary Tree such that sum of all greater keys is added to every key
  56. Morris traversal for Preorder
  57. Find the first circular tour that visits all petrol pumps
  58. Generate n-bit Gray Codes
  59. Convert a given Binary Tree to Doubly Linked List | Set 1
  60. Largest Rectangular Area in a Histogram | Set 2
  61. Tree Isomorphism Problem
  62. Expression Evaluation
  63. Print ancestors of a given binary tree node without recursion
  64. Convert a given Binary Tree to Doubly Linked List | Set 2
  65. Difference between sums of odd level and even level nodes of a Binary Tree
  66. Print Postorder traversal from given Inorder and Preorder traversals
  67. Find depth of the deepest odd level leaf node
  68. Check if all leaves are at same level
  69. Print Left View of a Binary Tree
  70. Add all greater values to every node in a given BST
  71. Remove all nodes which don't lie in any path with sum>= k
  72. Deepest left leaf node in a binary tree
  73. Count all distinct pairs with difference equal to k
  74. Sum of all the numbers that are formed from root to leaf paths
  75. Print all ways to break a string in bracket form
  76. Convert a given Binary Tree to Doubly Linked List | Set 3
  77. Print all nodes that don't have sibling
  78. Lowest Common Ancestor in a Binary Tree | Set 1
  79. Find distance between two nodes of a Binary Tree
  80. Print all nodes that are at distance k from a leaf node
  81. Print Right View of a Binary Tree
  82. Construct a tree from Inorder and Level order traversals | Set 1
  83. Print all nodes at distance k from a given node
  84. Find if there is a subarray with 0 sum
  85. Check if a given string is a rotation of a palindrome
  86. Reverse alternate levels of a perfect binary tree
  87. Find the maximum path sum between two leaves of a binary tree
  88. Anagram Substring Search (Or Search for all permutations)
  89. An Interesting Method to Generate Binary Numbers from 1 to n
  90. Check if two nodes are cousins in a Binary Tree
  91. How to efficiently implement k stacks in a single array?
  92. Find the first repeating element in an array of integers
  93. Find Height of Binary Tree represented by Parent array
  94. Length of the largest subarray with contiguous elements | Set 2
  95. Print nodes between two given level numbers of a binary tree
  96. Perfect Binary Tree Specific Level Order Traversal
  97. K'th Smallest/Largest Element in Unsorted Array | Set 1
  98. How to check if two given sets are disjoint?
  99. Find the closest leaf in a Binary Tree
  100. Given a binary string, count number of substrings that start and end with 1.
  101. Remove nodes on root to leaf paths of length < K
  102. Find sum of all left leaves in a given Binary Tree
  103. Check whether a binary tree is a full binary tree or not
  104. K'th Largest Element in BST when modification to BST is not allowed
  105. Given a binary tree, how do you remove all the half nodes?
  106. Online algorithm for checking palindrome in a stream
  107. Count frequencies of all elements in array in O(1) extra space and O(n) time
  108. Generate all possible sorted arrays from alternate elements of two given sorted arrays
  109. Count BST nodes that lie in a given range
  110. Z algorithm (Linear time pattern searching Algorithm)
  111. Count distinct elements in every window of size k
  112. Minimum time required to rot all oranges
  113. Minimum number of swaps required for arranging pairs adjacent to each other
  114. Validity of a given Tic-Tac-Toe board configuration
  115. Longest Consecutive Subsequence
  116. Transform One String to Another using Minimum Number of Given Operation
  117. Find maximum of minimum for every window size in a given array
  118. Print Common Nodes in Two Binary Search Trees
  119. Length of the longest valid substring
  120. Find four elements a, b, c and d in an array such that a+b = c+d
  121. Find the longest path in a matrix with given constraints
  122. Find three closest elements from given three sorted arrays
  123. Find Minimum Depth of a Binary Tree
  124. Construct Binary Tree from given Parent Array representation
  125. Number of paths with exactly k coins
  126. Minimum number of bracket reversals needed to make an expression balanced
  127. Check if a given array can represent Preorder Traversal of Binary Search Tree
  128. Find the maximum subarray XOR in a given array
  129. Find Count of Single Valued Subtrees
  130. Find all possible binary trees with given Inorder Traversal
  131. Construct a Binary Tree from Postorder and Inorder
  132. Closest leaf to a given node in Binary Tree
  133. Check if leaf traversal of two Binary Trees is same?
  134. Maximum difference between node and its ancestor in Binary Tree
  135. Lowest Common Ancestor in a Binary Tree | Set 2 (Using Parent Pointer)
  136. Maximum size rectangle binary sub-matrix with all 1s
  137. Check if removing an edge can divide a Binary Tree in two halves
  138. Triangle with no point inside
  139. Count pairs with given sum
  140. Vertical Sum in Binary Tree | Set 2 (Space Optimized)
  141. Perfect Binary Tree Specific Level Order Traversal | Set 2
  142. Convert a normal BST to Balanced BST
  143. Convert a given Binary Tree to Doubly Linked List | Set 4
  144. Return previous element in an expanding matrix
  145. Find subarray with given sum | Set 2 (Handles Negative Numbers)
  146. Create a Doubly Linked List from a Ternary Tree
  147. Check if two trees are Mirror
  148. Maximum product of a triplet (subsequnece of size 3) in array
  149. Pair with given product | Set 1 (Find if any pair exists)
  150. Converting Roman Numerals to Decimal lying between 1 to 3999
  151. Maximum sum of i*arr[i] among all rotations of a given array
  152. Find profession in a special family
  153. Reverse an array in groups of given size
  154. Direction at last square block
  155. Maximum element between two nodes of BST
  156. Convert a Binary Tree to a Circular Doubly Link List
  157. Binary Indexed Tree : Range Updates and Point Queries
  158. Flip Binary Tree
  159. Perfect reversible string
  160. Convert a Binary Tree to Threaded binary tree | Set 2 (Efficient)
  161. Count All Palindrome Sub-Strings in a String | Set 1
  162. Find pairs with given sum such that pair elements lie in different BSTs
  163. Count pairs whose products exist in array
  164. Maximum decimal value path in a binary matrix
  165. Subtree with given sum in a Binary Tree
  166. Find perimeter of shapes formed with 1s in binary matrix
  167. Find the closest element in Binary Search Tree
  168. Check if a string can be obtained by rotating another string 2 places
  169. Efficient method for 2's complement of a binary string
  170. Maximum determinant of a matrix with every values either 0 or n
  171. Find three element from different three arrays such that a + b + c = sum
  172. Sum of matrix in which each element is absolute difference of its row and column numbers
  173. Decimal representation of given binary string is divisible by 5 or not
  174. Maximum difference between frequency of two elements such that element having greater frequency is also greater
  175. Sum of matrix element where each elements is integer division of row and column
  176. Check if there exist two elements in an array whose sum is equal to the sum of rest of the array
  177. Check if reversing a sub array make the array sorted
  178. Find all triplets with zero sum
  179. Minimum operations required to set all elements of binary matrix
  180. Rearrange an array in maximum minimum form | Set 2 (O(1) extra space)
  181. Print matrix in antispiral form
  182. Count passing car pairs
  183. Sort array after converting elements to their squares
  184. Maximum and Minimum in a square matrix.
  185. Given two unsorted arrays, find all pairs whose sum is x
  186. Search, insert and delete in a sorted array
  187. Find sum of non-repeating (distinct) elements in an array
  188. Find the first repeated character in a string
  189. Noble integers in an array (count of greater elements is equal to value)
  190. Circular Queue | Set 2 (Circular Linked List Implementation)
  191. Construct an array from its pair-sum array
  192. Find maximum (or minimum) in Binary Tree
  193. Second largest element in BST
  194. Delete an element from array (Using two traversals and one traversal)
  195. Program for subtraction of matrices
  196. Program to print all palindromes in a given range
  197. Print All Distinct Elements of a given integer array
  198. Convert left-right representation of a binary tree to down-right
  199. Stack | Set 2 (Infix to Postfix)
  200. Stack | Set 4 (Evaluation of Postfix Expression)
  201. Given level order traversal of a Binary Tree, check if the Tree is a Min-Heap
  202. Find Excel column number from column title
  203. Level with maximum number of nodes
  204. Threaded Binary Tree | Insertion
  205. Generate all rotations of a given string
  206. Sort an array after applying the given equation
  207. Level order traversal line by line | Set 2 (Using Two Queues)
  208. Count subsets having distinct even numbers
  209. Determine if a string has all Unique Characters
  210. Convert Ternary Expression to a Binary Tree
  211. Program to count vowels in a string (Iterative and Recursive)
  212. Find distinct elements common to all rows of a matrix
  213. Length Of Last Word in a String
  214. Delete consecutive same words in a sequence
  215. Creating a tree with Left-Child Right-Sibling Representation
  216. Find Index of 0 to be replaced with 1 to get longest continuous sequence of 1s in a binary array | Set-2
  217. Count minimum right flips to set all values in an array
  218. Maximizing Unique Pairs from two arrays
  219. Leaf nodes from Preorder of a Binary Search Tree
  220. Program for Point of Intersection of Two Lines
  221. Decode a string recursively encoded as count followed by substring
  222. Merge Two Binary Trees by doing Node Sum (Recursive and Iterative)
  223. Count pairs from two sorted arrays whose sum is equal to a given value x
  224. Find all pairs (a, b) in an array such that a % b = k
  225. Magic Square | Even Order
  226. Break the number into three parts
  227. Sort a stack using a temporary stack
  228. Count quadruples from four sorted arrays whose sum is equal to a given value x
  229. Print common nodes on path from root (or common ancestors)
  230. Check if binary representations of two numbers are anagram
  231. Replace each node in binary tree with the sum of its inorder predecessor and successor
  232. Maximum length substring having all same characters after k changes
  233. Queue based approach for first non-repeating character in a stream
  234. Distinct adjacent elements in an array
  235. Minimum Swaps for Bracket Balancing
  236. Longest Possible Chunked Palindrome
  237. Count of occurrences of a "1(0+)1" pattern in a string
  238. Reverse a number using stack
  239. Number of turns to reach from one node to other in binary tree
  240. Print Levels of all nodes in a Binary Tree
  241. Reversing the first K elements of a Queue
  242. Find right sibling of a binary tree with parent pointers
  243. Reversing a Queue
  244. Evaluate a boolean expression represented as string
  245. Sum of all nodes in a binary tree
  246. Find sum of all right leaves in a given Binary Tree
  247. Sum of all leaf nodes of binary tree
  248. Smallest element repeated exactly ‘k’ times (not limited to small range)
  249. Print the nodes at odd levels of a tree
  250. Count pairs from two BSTs whose sum is equal to a given value x
  251. Find substrings that contain all vowels
  252. Maximum area rectangle by picking four sides from array
  253. Print all palindromic paths from top left to bottom right in a matrix
  254. Split the array and add the first part to the end
  255. Sum of all the parent nodes having child node x
  256. Minimum move to end operations to make all strings equal
  257. Sort a binary array using one traversal
  258. Sum of nodes on the longest path from root to leaf node
  259. Sort string of characters
  260. Difference between highest and least frequencies in an array
  261. Find the winner of a game where scores are given as a binary string
  262. Inorder Successor of a node in Binary Tree
  263. Count entries equal to x in a special matrix
  264. Rearrange a binary string as alternate x and y occurrences
  265. Print next greater number of Q queries
  266. Maximize the sum of arr[i]*i
  267. k-th missing element in increasing sequence which is not present in a given sequence
  268. Divide an array into k segments to maximize maximum of segment minimums
  269. Length of the longest substring with equal 1s and 0s
  270. Lexicographically next string
  271. Minimum cost to sort a matrix of numbers from 0 to n^2 - 1
  272. Longest subsequence such that difference between adjacents is one | Set 2
  273. Smallest subarray with k distinct numbers
  274. Distributing items when a person cannot take more than two items of same type
  275. Find n-th node of inorder traversal
  276. Find the first, second and third minimum elements in an array
  277. Probability of a random pair being the maximum weighted pair
  278. Program to find the minimum (or maximum) element of an array
  279. Product of maximum in first array and minimum in second
  280. Game of replacing array elements
  281. Find last index of a character in a string
  282. ZigZag Tree Traversal
  283. Maximum product of 4 adjacent elements in matrix
  284. Count subtrees that sum up to a given value x only using single recursive function
  285. Longest subarray with sum divisible by k
  286. Minimum characters to be replaced to remove the given substring
  287. Check if array contains contiguous integers with duplicates allowed
  288. Reverse individual words
  289. Longest Increasing consecutive subsequence
  290. Remove the forbidden strings
  291. Sum of f(a[i], a[j]) over all pairs in an array of n integers
  292. Maximum difference of zeros and ones in binary string | Set 2 (O(n) time)
  293. Simple Recursive solution to check whether BST contains dead end
  294. Interchange elements of first and last rows in matrix
  295. Priority Queue using Linked List
  296. Priority Queue using doubly linked list
  297. Non-Repeating Element
  298. Sort 1 to N by swapping adjacent elements
  299. Least frequent element in an array
  300. Print number in ascending order which contains 1, 2 and 3 in their digits.
  301. Check given array of size n can represent BST of n levels or not
  302. Find the only repetitive element between 1 to n-1
  303. Find sum of all nodes of the given perfect binary tree
  304. Reverse tree path
  305. Hypercube Graph
  306. Maximum Subarray Sum Excluding Certain Elements
  307. Sum of nodes at maximum depth of a Binary Tree
  308. Print sorted distinct elements of array
  309. Count palindrome words in a sentence
  310. Maximum difference between groups of size two
  311. Prime String
  312. Print all funny words in a string
  313. Number of Digits in a^b
  314. Odd numbers in N-th row of Pascal's Triangle
  315. Moser-de Bruijn Sequence
  316. Possible two sets from first N natural numbers difference of sums as D
  317. Sort an array which contain 1 to n values
  318. Find array elements that are greater than average
  319. Find maximum element of each row in a matrix
  320. Find largest subtree sum in a tree
  321. BST to a Tree with sum of all smaller keys
  322. Check if a number can be expressed as a^b | Set 2
  323. Word Wrap problem ( Space optimized solution )
  324. Largest connected component on a grid
  325. Find postorder traversal of BST from preorder traversal
  326. Count elements present in first array but not in second
  327. Count pairs with Bitwise AND as ODD number
  328. Longest common anagram subsequence from N strings
  329. Number of Co-prime pairs obtained from the sum of digits of elements in the given range
  330. Sum of all elements repeating 'k' times in an array
  331. Split the array and add the first part to the end | Set 2
  332. Print direction of moves such that you stay within the [-k, +k] boundary
  333. Length of longest consecutive zeroes in the binary representation of a number.
  334. Majority element in a circular array of 0's and 1's
  335. Value in a given range with maximum XOR
  336. Find Nth term of series 1, 4, 15, 72, 420...
  337. Check if an array is sorted and rotated
  338. Program to find the Nth term of series 0, 4, 14, 30, 51, 80, 114, 154, 200, ...
  339. Program to find the Nth term of the series 0, 14, 40, 78, 124, ...
  340. Count ways to reach a score using 1 and 2 with no consecutive 2s
  341. Area of squares formed by joining mid points repeatedly
  342. Check if a point is inside, outside or on the parabola
  343. Program to print the series 2, 1, 4, 3, 6, 5, .... up to N terms
  344. Check if a number is a Pythagorean Prime or not
  345. Sum of numbers from 1 to N which are divisible by 3 or 4
  346. Length of the longest Subarray with only Even Elements
  347. Number of special pairs possible from the given two numbers
  348. Find nth Term of the Series 1 2 2 4 4 4 4 8 8 8 8 8 8 8 8 ...
  349. Check if a number is Primorial Prime or not
  350. Check if a string is the typed name of the given name
  351. Check whether a binary string can be formed by concatenating given N numbers sequentially
  352. Rotate the sub-list of a linked list from position M to N to the right by K places
  353. K- Fibonacci series
  354. Check whether the vowels in a string are in alphabetical order or not
  355. Largest number divisible by 90 that can be made using 0 and 5
  356. Minimum swaps required to make a binary string alternating
  357. Count changes in Led Lights to display digits one by one
  358. Check whether bitwise OR of N numbers is Even or Odd
  359. Program to find Nth term divisible by a or b
  360. Minimum boxes required to carry all gifts
  361. Assign other value to a variable from two possible values
  362. Find amount to be added to achieve target ratio in a given mixture
  363. Find time taken for signal to reach all positions in a string
  364. Treasure and Cities
  365. Minimize Cost with Replacement with other allowed
  366. Minimum number of operations required to delete all elements of the array
  367. Check whether product of digits at even places of a number is divisible by K
  368. Replace every array element by Bitwise Xor of previous and next element
  369. Longest subarray with elements having equal modulo K
  370. GCD of a number raised to some power and another number
  371. Smallest subarray such that all elements are greater than K
  372. Position after taking N steps to the right and left in an alternate manner
  373. Find the count of substrings in alphabetic order
  374. Change K elements so that (a1^2 + a2^2 + …+ aN^2 ) <= (a1 + a2 +…+ aN) becomes true
  375. Fibonacci problem (Value of Fib(N)*Fib(N) - Fib(N-1) * Fib(N+1))
  376. Sum of first N natural numbers which are not powers of K
  377. Check if a prime number can be expressed as sum of two Prime Numbers
  378. Find the other number when LCM and HCF given
  379. Sum of the elements from index L to R in an array when arr[i] = i * (-1)^i
  380. Count of cyclic permutations having XOR with other binary string as 0
  381. Sum of all natural numbers in range L to R
  382. Sum of all odd natural numbers in range L and R
  383. Count Numbers with N digits which consists of even number of 0’s
  384. Find determinant of matrix generated by array rotation
  385. Minimum elements to change so that for an index i all elements on the left are -ve and all elements on the right are +ve
  386. Program to find first N Iccanobif Numbers
  387. Maximize the difference between two subsets of a set with negatives
  388. Program to print Step Pattern
  389. Filling diagonal to make the sum of every row, column and diagonal equal of 3x3 matrix
  390. Minimum value to be added to X such that it is at least Y percent of N
  391. XOR of XORs of all sub-matrices
  392. Print the lexicographically smallest DFS of the graph starting from 1
  393. Count the Number of Binary Search Trees present in a Binary Tree
  394. Count of all even numbers in the range [L, R] whose sum of digits is divisible by 3
  395. Replace every consonant sequence with its length in the given string
  396. Check if product of digits of a number at even and odd places is equal
  397. Minimum cost to make a string free of a subsequence
  398. Find smallest number K such that K % p = 0 and q % K = 0
  399. Probability of A winning the match when individual probabilities of hitting the target given
  400. Print n numbers such that their sum is a perfect square
  401. Sum of all odd factors of numbers in the range [l, r]
  402. Check if a number can be represented as sum of non zero powers of 2
  403. Find kth smallest number in range [1, n] when all the odd numbers are deleted
  404. Find Nth term of the series 1, 6, 18, 40, 75, ....
  405. Find Nth term of the series 1, 5, 32, 288 ...
  406. Count numbers which are divisible by all the numbers from 2 to 10
  407. Find last five digits of a given five digit number raised to power five
  408. Ways to place 4 items in n^2 positions such that no row/column contains more than one
  409. Find the count of numbers that can be formed using digits 3, 4 only and having length at max N.
  410. Number of ways to pair people
  411. Maximum Primes whose sum is equal to given N
  412. Third last digit in 5^N for given N
  413. Sum of the series 1^1 + 2^2 + 3^3 + ..... + n^n using recursion
  414. Sum of all i such that (2^i + 1) % 3 = 0 where i is in range [1, n]
  415. Sum of all even factors of numbers in the range [l, r]
  416. Count numbers having N 0's and and M 1's with no leading zeros
  417. Maximum average of a subarray of size of atleast X and atmost Y
  418. Find the total guests that are present at the party
  419. Count rotations of N which are Odd and Even
  420. Count of pairs from 1 to a and 1 to b whose sum is divisible by N
  421. Check if the given array can be reduced to zeros with the given operation performed given number of times
  422. Largest sphere that can be inscribed within a cube which is in turn inscribed within a right circular cone
  423. Create a mirror tree from the given binary tree
  424. Find amount of water wasted after filling the tank
  425. Given count of digits 1, 2, 3, 4, find the maximum sum possible
  426. Print last character of each word in a string
  427. Print all leaf nodes of a binary tree from right to left
  428. Count distinct points visited on the number line
  429. Check whether the sum of element of a node is equal to the given key value
  430. Elements greater than the previous and next element in an Array