What are the various approaches of Sliding Window ?
highindex - lowIndex +1
Common errors in 2 pointer method ?
</right>
Whats the gotcha for sort in js ?
The sort is alphabetic , so we need to pass the function to make it sort properly
What does in-place replacement and constant space signify ?
It should immediately indicate swapping
Whenever we need to generate integer from strings , add (sum), multiply or have any integer operations. What is a potential pitfall
What are the properties of XOR ?
1 ^ 1 = 0
29 ^ 29 = 0
Taking XOR of a number with 0 returns the same number, e.g.,
1 ^ 0 = 1
31 ^ 0 = 31
XOR is Associative & Commutative, which means:
(a ^ b) ^ c = a ^ (b ^ c)
a ^ b = b ^ a
How to invert bytes of a number ?
number ^ complement = all_bits_set
number ^ number ^ complement = number ^ all_bits_set
0 ^ complement = number ^ all_bits_set
complement = number ^ all_bits_set
How to store a binary tree ?
If parent is at i
LeftChild 2i
RIghtChild2i+1
Level order traversal , keep missing rows blank
If the height of the binary tree is h , how many element in full bionary tree ?
2^(h+1)-1
Whats hieght of a binary tree ?
log N
What should immeditaley come to mind when you see hash map and charachetrs
Hashmap of 26 charachters
Do you need repetitions ?
During DFS , whats the complexity?
, it is the size of the tree
What are the 2 key terms of tree traversal ?
Difefrence between BFS and DFS
What is the complexity of inserting into the a sorted array ?
Inserting a number in a sorted list will take O(N) time if there are ‘N’ numbers in the list. This insertion will be similar to the Insertion sort.
What are the functions a heap ?
Push()
pop()
length
peek()
What is a balanced binary search tree ?
If the depth of 2 subtrees of any node differ no more than 1
Whats the time complexity of knapsack
DP , when to pass count , and when to return count ?
What should we remember while passing values into recursion ?
What are the steps for topological sort ?