Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

FIND TWO MISSING ELEMENTS https://www.geeksforgeeks.

org/find-two-missing-numbers-set-2-xor-based-solution/

https://www.geeksforgeeks.org/find-two-missing-numbers-set-1-an-interesting-linear-time-solution/

 
Finding the duplicates in O(n) time https://onlinegdb.com/SJgig8alD
complexity and O(1) space complexity
https://www.geeksforgeeks.org/find-duplicates-in-on-time-and-constant-extra-space/

 
Print all pairs of given sum https://www.geeksforgeeks.org/print-all-pairs-with-given-sum/
Removing duplicates in-place of a sorted https://www.geeksforgeeks.org/remove-duplicates-sorted-array/
array
   
Strings  
 
Check two strings are anagram or not https://www.geeksforgeeks.org/check-whether-two-strings-are-anagram-of-each-other/

Create an character array (256), For the first string, increment the corresponding index value.
For the second string, decrement the corresponding index value.
|Finally iterate through the character array, if all values are 0, then they are anagrams, else they are not
 
Reverse a string using recursion https://onlinegdb.com/r1cH6b7ZP
Reverse words in a string Reverse words in a string
 
This is mine
O/P : mine is This

 
My code
https://onlinegdb.com/BJ8bSfy-w
 
ARRAY ROTATION https://www.geeksforgeeks.org/array-rotation/
O(n) - Time complexity
O(1) - Space complexity
 
This is different approach:
https://onlinegdb.com/r1U9OE7ZP

Algo:
1. reverse the first k elements
2. reverse the remaining n-k elements
3. reverse the entire array
First repeating characters in a stream https://www.geeksforgeeks.org/queue-based-approach-for-first-non-repeating-character-in-a-stream/

 
Input : a a b c
Output : a -1 b b
 
 

 
Moving zeros to end in an array of 1s and https://onlinegdb.com/SkjJs4XZD
0s O(n) - time complexity
O(1) - Space Complexity
One pass through the array

More solutions:
https://www.geeksforgeeks.org/segregate-0s-and-1s-in-an-array-by-traversing-array-once/
 
Move all zeroes to end of array https://onlinegdb.com/SJqqsE7bw

For more solutions:


https://www.geeksforgeeks.org/move-zeroes-end-array/
 
   

You might also like