Skip to content

Vicky-Jha/Must_Do_Coding_Interview_Questions_GFG

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 

Repository files navigation

Language  License 

My C++ Solutions

Topics

ARRAYS

# Title Solution Time Space
1 Subarray with given sum C++ O(n) O(1)
2 Count the triplets C++ O(n^2) O(n)
3 Kadane’s Algorithm C++ O(n) O(1)
4 Missing number in array C++ O(n) O(1)
5 Merge two sorted arrays C++ O((n+m) log(n+m)) O(1)
6 Rearrange array alternatively C++ O(n) O(1)
7 Number of pairs C++ O((N + M)log(N)) O(1)
8 Inversion of Array C++ O(NLogN) O(N)
9 Sort an array of 0s, 1s and 2s C++ O(n) O(1)
10 Equilibrium point C++ O(n) O(1)
11 Leaders in an array C++ O(n) O(n)
12 Minimum Platforms C++ O(nlogn) O(n)
13 Reverse array in groups C++ O(n) O(n)
14 K’th smallest element C++ O(n) O(1)
15 Trapping Rain Water C++ O(n) O(n)
16 Pythagorean Triplet C++ O(max(Arr[i])2) O(max(Arr[i]))
17 Chocolate Distribution Problem C++ O(N*Log(N)) O(1)
18 Stock buy and sell C++ O(N) O(N)
19 Element with left side smaller and right side greater C++ O(N) O(N)
20 Convert array into Zig-Zag fashion C++ O(N) O(1)
21 Last Index of 1 C++ O(N) O(1)
22 Spirally traversing a matrix C++ O(r*c) O(r*c)
23 Largest Number formed from an Array C++ O(nlogn) O(1)

STRING

# Title Solution Time Space
1 Reverse words in a given string C++ O(mod(S)) O(mod(S))
2 Permutations of a given string C++ O(n! * n) O(n)
3 Longest_Palindrome_in_a_String C++ O(mod(S)) O(1)