-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathnotesRemember.txt
85 lines (50 loc) · 1.89 KB
/
notesRemember.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
Coding interview
- discuss edge case
- explain approach to understand the interview
- code like production ready e.g. function name / variable name should be meaningfull and understand
- Dry run code
- Thinking of loud the problem
-
----------------------------------------------------------------------------
const map1 = new Map();
map1.set('a', 1);
map1.set('b', 2);
map1.set('c', 3);
console.log(map1.get('a'));
// Expected output: 1
map1.set('a', 97);
console.log(map1.get('a'));
// Expected output: 97
console.log(map1.size);
// Expected output: 3
map1.delete('b');
console.log(map1.has('a'))
console.log(map1.size);
// Expected output: 2
----------------------------------------------------------------------------
const setMap = new Set();
setMap.add(1);
setMap.has(1);
setMap.size();
setMap.values();
console.log(setMap);
----------------------------------------------------------------------------
JAVASCRIPT does not provide heap Data Structure
for practice leetCode provide lib
new MinPriorityQeueu();
----------------------------------------------------------------------------
ferquency pattern algorithm
- group anagrams
- find all anagrans
- findKthLargest
----------------------------------------------------------------------------
when you see problem realted brackets then stack Data Structure need to use.
----------------------------------------------------------------------------
A greedy algorithm, as the name suggests, always makes the choice that seems to be the best at that moment.
----------------------------------------------------------------------------
Morris Traversal is a tree traversal technique that uses no additional space
(like a stack or recursion)
and operates in O(1) space complexity while performing O(n) time complexity traversal.
It is commonly applied to binary trees and comes in two variants:
Inorder Morris Traversal
Preorder Morris Traversal