-
Notifications
You must be signed in to change notification settings - Fork 88
/
index.html
789 lines (748 loc) · 31.7 KB
/
index.html
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>MyInterviewBit</title>
<meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
<link rel="stylesheet" type="text/css" href="https://unpkg.com/[email protected]/themes/prism.css">
<!--link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/docsify/4.9.4/themes/vue.css"-->
<link rel="stylesheet" type="text/css" href="custom.css">
<script src="https://unpkg.com/[email protected]/prism.js"></script>
<script src="https://unpkg.com/[email protected]/components/prism-c.min.js"></script>
<script src="https://unpkg.com/[email protected]/components/prism-cpp.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/marked/3.0.0/marked.min.js"></script>
<script>
chapters =
{
"Arrays": {
"Array math": {
"Min Steps in Infinite Grid": {"pts": "150", "tags": ["Directi"]},
"Add One To Number": {"pts": "225"},
"Max Sum Contiguous Subarray": {"pts": "225", "tags": ["Amazon", "Goldman Sachs"]},
"Maximum Absolute Difference": {"pts": "250"},
"Repeat and Missing Number Array": {"pts": "350", "tags": ["Amazon"]},
"Flip": {"pts": "400", "tags": ["VMWare"]}
},
"Simulation array": {
"Max Non Negative SubArray": {"pts": "150"},
"Spiral Order Matrix II": {"pts": "225", "tags": ["JP Morgan", "Amazon"]},
"Pascal Triangle": {"pts": "225", "tags": ["Amazon"]},
"Kth Row of Pascal's Triangle": {"pts": "225"},
"Anti Diagonals": {"pts": "225", "tags": ["Adobe"]}
},
"Bucketing": {
"Noble Integer": {"pts": "200"},
"Triplets with Sum between given range": {"pts": "200"},
"Largest Number": {"pts": "225", "tags": ["Amazon", "Goldman Sachs"]},
"Wave Array": {"pts": "225", "tags": ["Adobe", "Amazon"]},
"Hotel Bookings Possible": {"pts": "225", "tags": ["Goldman Sachs"]},
"Max Distance": {"pts": "250", "tags": ["Amazon"]},
"Maximum Unsorted Subarray": {"pts": "250", "tags": ["Amazon"]},
"Find Duplicate in Array": {"pts": "450", "tags": ["Amazon", "VMWare", "Riverbed"]},
"Maximum Consecutive Gap": {"pts": "450", "tags": ["Hunan Asset"]}
},
"Array": {
"MAXSPPROD": {"pts": "200"}
},
"Arrangement": {
"Largest Number": {"pts": "225", "tags": ["Amazon", "Goldman Sachs"]},
"Rotate Matrix": {"pts": "300", "tags": ["Amazon"]},
"Next Permutation": {"pts": "300", "tags": ["Amazon"]},
"Find Permutation": {"pts": "300"}
},
"Value ranges": {
"Merge Intervals": {"pts": "225"},
"Merge Overlapping Intervals": {"pts": "225", "tags": ["Amazon"]}
},
"Bucketing or sorting": {
"Hotel Bookings Possible": {"pts": "225", "tags": ["Goldman Sachs"]},
"Wave Array": {"pts": "225", "tags": ["Adobe", "Amazon"]},
"Largest Number": {"pts": "225", "tags": ["Amazon", "Goldman Sachs"]},
"Max Distance": {"pts": "250", "tags": ["Amazon"]},
"Maximum Unsorted Subarray": {"pts": "250", "tags": ["Amazon"]},
"Find Duplicate in Array": {"pts": "450", "tags": ["Amazon", "VMWare", "Riverbed"]},
"Maximum Consecutive Gap": {"pts": "450", "tags": ["Hunan Asset"]}
},
"Space recycle": {
"Set Matrix Zeros": {"pts": "300", "tags": ["Oracle", "Amazon"]},
"First Missing Integer": {"pts": "300", "tags": ["Model N", "InMobi", "Amazon"]}
},
"Missing / repeated number": {
"First Missing Integer": {"pts": "300", "tags": ["Model N", "InMobi", "Amazon"]},
"Repeat and Missing Number Array": {"pts": "350", "tags": ["Amazon"]},
"Find Duplicate in Array": {"pts": "450", "tags": ["Amazon", "VMWare", "Riverbed"]},
"N/3 Repeat Number": {"pts": "600"}
}
},
"Math": {
"Adhoc": {
"Prime Sum": {"pts": "150", "tags": ["Epic systems"]},
"Sum of pairwise Hamming Distance": {"pts": "200"},
"FizzBuzz": {"pts": "200"},
"Power Of Two Integers": {"pts": "250", "tags": ["Housing", "Amazon"]}
},
"Base conversion": {
"Excel Column Number": {"pts": "175", "tags": ["Amazon"]},
"Excel Column Title": {"pts": "175", "tags": ["Amazon"]}
},
"Digit op": {
"Palindrome Integer": {"pts": "200", "tags": ["HCL"]},
"Reverse integer": {"pts": "200", "tags": ["HCL", "Bloomberg"]}
},
"Number theory": {
"Greatest Common Divisor": {"pts": "200", "tags": ["NetApp"]},
"Trailing Zeros in Factorial": {"pts": "250", "tags": ["Jabong", "Zillow"]},
"Sorted Permutation Rank": {"pts": "250", "tags": ["Housing", "Zenefits"]},
"Largest Coprime Divisor": {"pts": "250"},
"Sorted Permutation Rank with Repeats": {"pts": "500", "tags": ["Housing", "Zenefits"]}
},
"Array dp": {
"Numbers of length N and value less than K": {"pts": "200"}
},
"Number encoding": {
"Rearrange Array": {"pts": "250"}
},
"Combinatorics": {
"City Tour": {"pts": "300"},
"Grid Unique Paths": {"pts": "375", "tags": ["Amazon", "Adobe"]}
}
},
"Binary Search": {
"Search answer": {
"Matrix Median": {"pts": "225"},
"Square Root of Integer": {"pts": "275", "tags": ["Amazon"]},
"Painter's Partition Problem": {"pts": "350", "tags": ["Codenation"]},
"Allocate Books": {"pts": "350"}
},
"Simple binary search": {
"Matrix Search": {"pts": "250"},
"Search for a Range": {"pts": "250"},
"Sorted Insert Position": {"pts": "250"}
},
"Search step simulation": {
"Implement Power Function": {"pts": "275"}
},
"Sort modification": {
"Rotated Sorted Array Search": {"pts": "325", "tags": ["Amazon"]},
"Median of Array": {"pts": "325", "tags": ["Amazon", "VMWare", "Goldman Sachs"]}
}
},
"Strings": {
"String simulation": {
"Palindrome String": {"pts": "150"},
"Longest Common Prefix": {"pts": "225"},
"Count And Say": {"pts": "250"}
},
"Programming": {
"Amazing Subarrays": {"pts": "150"},
"Stringoholics": {"pts": "300"}
},
"String tricks": {
"Minimum Characters required to make a String Palindromic": {"pts": "200", "tags": ["Amazon"]},
"Longest Palindromic Substring": {"pts": "500", "tags": ["Amazon", "Groupon"]}
},
"String search": {
"Minimum Characters required to make a String Palindromic": {"pts": "200", "tags": ["Amazon"]},
"Implement StrStr": {"pts": "225", "tags": ["Amazon", "Qualcomm", "Wipro"]}
},
"String parsing": {
"Minimum Characters required to make a String Palindromic": {"pts": "200", "tags": ["Amazon"]},
"Compare Version Numbers": {"pts": "225", "tags": ["Intuit", "Amazon"]},
"Atoi": {"pts": "250", "tags": ["Adobe", "Nvidia", "Agilent systems", "Bloomberg", "Amazon", "Groupon"]},
"Valid Number": {"pts": "250", "tags": ["Adobe"]},
"Valid Ip Addresses": {"pts": "250", "tags": ["Amazon"]}
},
"Words": {
"Length of Last Word": {"pts": "225", "tags": ["Amazon"]},
"Reverse the String": {"pts": "250", "tags": ["Qualcomm", "Amazon", "Cisco"]}
},
"String math": {
"Roman To Integer": {"pts": "250", "tags": ["Amazon"]},
"Integer To Roman": {"pts": "250", "tags": ["Amazon"]},
"Add Binary Strings": {"pts": "300"},
"Power of 2": {"pts": "350", "tags": ["Amazon"]},
"Multiply Strings": {"pts": "375"}
},
"Pretty print": {
"Justified Text": {"pts": "300"},
"Zigzag String": {"pts": "300"},
"Pretty Json": {"pts": "400"}
}
},
"Bit Manipulation": {
"Bucketing": {
"Min XOR value": {"pts": "200", "tags": ["Booking.com"]}
},
"Bit play": {
"Number of 1 Bits": {"pts": "200", "tags": ["Adobe"]},
"Reverse Bits": {"pts": "225", "tags": ["Nvidia", "HCL", "Amazon"]},
"Divide Integers": {"pts": "250", "tags": ["Amazon"]},
"Different Bits Sum Pairwise": {"pts": "300"}
},
"Bit array": {
"Single Number": {"pts": "275", "tags": ["Amazon"]},
"Single Number II": {"pts": "275", "tags": ["Amazon"]}
}
},
"Two Pointers": {
"Multiple arrays": {
"Merge Two Sorted Lists II": {"pts": "200", "tags": ["Adobe", "Expedia"]},
"Intersection Of Sorted Arrays": {"pts": "225"}
},
"Two pointer": {
"Minimize the absolute difference": {"pts": "200"}
},
"Sorting": {
"3 Sum": {"pts": "225", "tags": ["Amazon"]},
"3 Sum Zero": {"pts": "225"},
"Counting Triangles": {"pts": "225"},
"Diffk": {"pts": "300"}
},
"Inplace update": {
"Remove Duplicates from Sorted Array": {"pts": "250", "tags": ["United Healthgroup", "Amazon", "Expedia"]},
"Remove Duplicates from Sorted Array II": {"pts": "250", "tags": ["Expedia"]},
"Remove Element from Array": {"pts": "250", "tags": ["Amazon"]},
"Sort by Color": {"pts": "325"}
},
"Tricks": {
"Max Continuous Series of 1s": {"pts": "300", "tags": ["VMWare"]},
"Array 3 Pointers": {"pts": "400"},
"Container With Most Water": {"pts": "400", "tags": ["Amazon"]}
}
},
"Linked Lists": {
"List 2 pointer": {
"Palindrome List": {"pts": "200", "tags": ["Amazon"]},
"Remove Duplicates from Sorted List": {"pts": "300", "tags": ["VMWare"]},
"Remove Duplicates from Sorted List II": {"pts": "300", "tags": ["VMWare"]},
"Merge Two Sorted Lists": {"pts": "300", "tags": ["Amazon"]},
"Remove Nth Node from List End": {"pts": "350", "tags": ["HCL", "Amazon"]},
"Rotate List": {"pts": "350", "tags": ["Amazon"]},
"Reverse Link List II": {"pts": "450", "tags": ["Amazon"]},
"Reorder List": {"pts": "600", "tags": ["Amazon"]}
},
"Pointer move": {
"K reverse linked list": {"pts": "200", "tags": ["Amazon"]},
"Swap List Nodes in pairs": {"pts": "350", "tags": ["Amazon"]},
"Reverse Link List II": {"pts": "450", "tags": ["Amazon"]},
"Reorder List": {"pts": "600", "tags": ["Amazon"]}
},
"List math": {
"Add Two Numbers as Lists": {"pts": "250", "tags": ["Amazon", "Qualcomm"]},
"List Cycle": {"pts": "600", "tags": ["Amazon", "NetApp"]}
},
"List sort": {
"Partition List": {"pts": "275"},
"Insertion Sort List": {"pts": "300"},
"Sort List": {"pts": "350"}
},
"List trick": {
"Reverse Link List II": {"pts": "450", "tags": ["Amazon"]},
"Reorder List": {"pts": "600", "tags": ["Amazon"]}
},
"List cycle": {
"List Cycle": {"pts": "600", "tags": ["Amazon", "NetApp"]}
}
},
"Stacks And Queues": {
"Stack simple": {
"Simplify Directory Path": {"pts": "250"},
"Redundant Braces": {"pts": "300", "tags": ["Amazon"]}
},
"Cleverstack": {
"Nearest Smaller Element": {"pts": "350", "tags": ["Amazon"]},
"Largest Rectangle in Histogram": {"pts": "450", "tags": ["Amazon"]},
"Sliding Window Maximum": {"pts": "450", "tags": ["Chronus", "Walmart labs", "Amazon"]}
},
"Stack math": {
"Evaluate Expression": {"pts": "400"},
"Rain Water Trapped": {"pts": "400", "tags": ["Qualcomm", "Amazon"]}
},
"Multiple stack": {
"Min Stack": {"pts": "400", "tags": ["Amazon", "Adobe"]}
}
},
"Backtracking": {
"Subsets": {
"Subset": {"pts": "250", "tags": ["Amazon"]},
"Combinations": {"pts": "300", "tags": ["Amazon", "Adobe"]},
"Combination Sum": {"pts": "300", "tags": ["Amazon", "Adobe"]},
"Combination Sum II": {"pts": "300", "tags": ["Amazon", "Infosys"]},
"Subsets II": {"pts": "300", "tags": ["Amazon"]}
},
"Bruteforce builder": {
"Letter Phone": {"pts": "250", "tags": ["Epic systems"]},
"Palindrome Partitioning": {"pts": "300", "tags": ["Amazon"]},
"Generate all Parentheses II": {"pts": "350"}
},
"Pruned builder": {
"Palindrome Partitioning": {"pts": "300", "tags": ["Amazon"]},
"Generate all Parentheses II": {"pts": "350"},
"NQueens": {"pts": "550", "tags": ["Qualcomm", "Amazon"]},
"Sudoku": {"pts": "700", "tags": ["Qualcomm"]}
},
"Permutations": {
"Permutations": {"pts": "350", "tags": ["Adobe"]}
},
"Maths and backtracking": {
"Gray Code": {"pts": "350"},
"Kth Permutation Sequence": {"pts": "350", "tags": ["Amazon"]}
},
"Game solving": {
"NQueens": {"pts": "550", "tags": ["Qualcomm", "Amazon"]},
"Sudoku": {"pts": "700", "tags": ["Qualcomm"]}
}
},
"Hashing": {
"Hash search": {
"Colorful Number": {"pts": "150", "tags": ["Epic systems"]},
"Largest Continuous Sequence Zero Sum": {"pts": "200"},
"2 Sum": {"pts": "300", "tags": ["Amazon"]},
"4 Sum": {"pts": "325", "tags": ["Amazon"]},
"Valid Sudoku": {"pts": "325", "tags": ["Amazon"]},
"Diffk II": {"pts": "375"}
},
"Key formation": {
"Anagrams": {"pts": "350", "tags": ["Amazon", "Goldman Sachs"]},
"Equal": {"pts": "350"},
"Copy List": {"pts": "450", "tags": ["Amazon"]}
},
"Hashing two pointer": {
"Longest Substring Without Repeat": {"pts": "350", "tags": ["Amazon"]},
"Window String": {"pts": "350", "tags": ["Directi"]}
},
"Maths and hashing": {
"Fraction": {"pts": "450", "tags": ["Amazon"]},
"Points on the Straight Line": {"pts": "450", "tags": ["Amazon", "InMobi"]}
},
"Incremental hash": {
"Substring Concatenation": {"pts": "1000"}
}
},
"Heaps And Maps": {
"Heap": {
"N max pair combinations": {"pts": "200", "tags": ["Liv.ai"]},
"Magician and Chocolates": {"pts": "250"},
"Merge K Sorted Lists": {"pts": "600", "tags": ["Flipkart", "Amazon"]}
},
"Math": {
"Ways to form Max Heap": {"pts": "200", "tags": ["Directi"]}
},
"Heapmap": {
"Distinct Numbers in Window": {"pts": "600", "tags": ["Amazon"]},
"LRU Cache": {"pts": "1000", "tags": ["Adobe", "Citigroup", "Amazon"]}
}
},
"Tree Data Structure": {
"Traversal": {
"Vertical Order traversal of Binary Tree": {"pts": "200", "tags": ["Amazon"]},
"Inorder Traversal": {"pts": "350", "tags": ["Amazon"]},
"Postorder Traversal": {"pts": "350", "tags": ["Amazon"]},
"Preorder Traversal": {"pts": "350", "tags": ["Amazon"]}
},
"Tries": {
"Hotel Reviews": {"pts": "200", "tags": ["Booking.com"]}
},
"Simple tree ops": {
"Balanced Binary Tree": {"pts": "275", "tags": ["Amazon"]}
},
"2 trees": {
"Identical Binary Trees": {"pts": "300", "tags": ["Amazon"]},
"Symmetric Binary Tree": {"pts": "300", "tags": ["Amazon"]}
},
"Tree construction": {
"Inorder Traversal of Cartesian Tree": {"pts": "300", "tags": ["Amazon"]},
"Sorted Array To Balanced BST": {"pts": "300", "tags": ["VMWare", "Amazon"]},
"Binary Tree From Inorder And Postorder": {"pts": "375", "tags": ["Amazon"]},
"Construct Binary Tree From Inorder And Preorder": {"pts": "375", "tags": ["Amazon"]}
},
"Bst traversal": {
"Kth Smallest Element In Tree": {"pts": "300", "tags": ["Amazon"]},
"2-Sum Binary Tree": {"pts": "400", "tags": ["Amazon"]},
"BST Iterator": {"pts": "500", "tags": ["Amazon"]},
"Recover Binary Search Tree": {"pts": "750", "tags": ["Amazon"]}
},
"Inplace change": {
"Invert the Binary Tree": {"pts": "300"}
},
"Level order": {
"ZigZag Level Order Traversal BT": {"pts": "350", "tags": ["Amazon"]},
"Populate Next Right Pointers Tree": {"pts": "900", "tags": ["Amazon"]}
},
"Root to leaf": {
"Path Sum": {"pts": "350", "tags": ["Amazon"]},
"Root to Leaf Paths With Sum": {"pts": "350", "tags": ["Amazon"]},
"Max Depth of Binary Tree": {"pts": "350", "tags": ["Goldman Sachs", "Bloomberg"]},
"Min Depth of Binary Tree": {"pts": "350", "tags": ["Amazon"]},
"Sum Root to Leaf Numbers": {"pts": "350"}
},
"Trie": {
"Shortest Unique Prefix": {"pts": "350"}
},
"Tree search": {
"Least Common Ancestor": {"pts": "450", "tags": ["Adobe", "Amazon"]}
},
"Linkedlist tree": {
"Flatten Binary Tree to Linked List": {"pts": "500", "tags": ["Adobe", "Amazon"]}
},
"Interval tree": {
"Order of People Heights": {"pts": "700"}
}
},
"Dynamic Programming": {
"Simple array dp": {
"Length of Longest Subsequence": {"pts": "200"},
"Largest area of rectangle with permutations": {"pts": "200", "tags": ["Directi"]},
"Ways to Decode": {"pts": "225", "tags": ["Amazon"]},
"Stairs": {"pts": "225", "tags": ["Morgan Stanley", "Amazon", "Intel"]},
"Intersecting Chords in a Circle": {"pts": "300"}
},
"Greedy or dp": {
"Tushar's Birthday Bombs": {"pts": "200"},
"Jump Game Array": {"pts": "225", "tags": ["Amazon", "Ebay"]},
"Min Jumps Array": {"pts": "300", "tags": ["Amazon", "Ebay"]}
},
"Dp tricky": {
"Longest Arithmetic Progression": {"pts": "200"},
"N digit numbers with digit sum S": {"pts": "200"},
"Ways to color a 3xN Board": {"pts": "200", "tags": ["Codenation"]},
"Shortest common superstring": {"pts": "200"},
"Kth Manhattan Distance Neighbourhood": {"pts": "200", "tags": ["Liv.ai"]},
"Coins in a Line": {"pts": "300"},
"Evaluate Expression To True": {"pts": "350", "tags": ["Amazon"]},
"Longest valid Parentheses": {"pts": "700"},
"Best Time to Buy and Sell Stocks III": {"pts": "700", "tags": ["Amazon"]}
},
"Matrix dp": {
"Kingdom War": {"pts": "200"},
"Min Sum Path in Matrix": {"pts": "300", "tags": ["Amazon"]},
"Dungeon Princess": {"pts": "300"},
"Min Sum Path in Triangle": {"pts": "300"},
"Unique Paths in a Grid": {"pts": "300"},
"Max Rectangle in Binary Matrix": {"pts": "350"},
"Rod Cutting": {"pts": "350"},
"Queen Attack": {"pts": "350"}
},
"Suffix / prefix dp": {
"Sub Matrices with sum Zero": {"pts": "200"},
"Coin Sum Infinite": {"pts": "225"},
"Best Time to Buy and Sell Stocks I": {"pts": "300", "tags": ["Amazon"]},
"Max Product Subarray": {"pts": "300", "tags": ["Amazon"]},
"Arrange II": {"pts": "350", "tags": ["Amazon"]}
},
"Adhoc": {
"Largest area of rectangle with permutations": {"pts": "200", "tags": ["Directi"]},
"Best Time to Buy and Sell Stocks II": {"pts": "225", "tags": ["Amazon"]}
},
"Knapsack": {
"N digit numbers with digit sum S": {"pts": "200"},
"Tushar's Birthday Party": {"pts": "200", "tags": ["Snapdeal"]},
"Flip Array": {"pts": "200"},
"Equal Average Partition": {"pts": "350", "tags": ["Amazon"]}
},
"Derived dp": {
"Max Sum Without Adjacent Elements": {"pts": "225", "tags": ["Epic systems"]}
},
"2d string dp": {
"Edit Distance": {"pts": "300", "tags": ["Amazon"]},
"Longest Increasing Subsequence": {"pts": "300", "tags": ["Epic systems", "Amazon"]},
"Repeating Sub-Sequence": {"pts": "300"},
"Distinct Subsequences": {"pts": "325"},
"Interleaving Strings": {"pts": "500"},
"Regular Expression Match": {"pts": "500"},
"Regular Expression II": {"pts": "500"},
"Scramble String": {"pts": "500"}
},
"Multiply dp": {
"Intersecting Chords in a Circle": {"pts": "300"},
"Unique Binary Search Trees II": {"pts": "400", "tags": ["Amazon", "Samsung"]},
"Count Permutations of BST": {"pts": "400"}
},
"Preprocess dp": {
"Max Rectangle in Binary Matrix": {"pts": "350"}
},
"Dp optimized backtrack": {
"Word Break II": {"pts": "350", "tags": ["IBM"]}
},
"Tree dp": {
"Max Sum Path in Binary Tree": {"pts": "400", "tags": ["Directi", "Amazon"]}
},
"Breaking words": {
"Word Break": {"pts": "400", "tags": ["IBM"]},
"Palindrome Partitioning II": {"pts": "400", "tags": ["Amazon"]},
"Scramble String": {"pts": "500"}
}
},
"Greedy Algorithm": {
"Bucket 5": {
"Highest Product": {"pts": "200", "tags": ["Coursera", "Amazon"]}
},
"Bucket 6": {
"Bulbs": {"pts": "200"}
},
"Bucket 1": {
"Distribute Candy": {"pts": "300", "tags": ["Flipkart", "Amazon"]},
"Assign Mice to Holes": {"pts": "300", "tags": ["Amazon"]}
},
"Bucket 4": {
"Seats": {"pts": "300", "tags": ["Walmart labs"]}
},
"Bucket 3": {
"Majority Element": {"pts": "400", "tags": ["Amazon"]}
},
"Bucket 2": {
"Gas Station": {"pts": "700", "tags": ["Bloomberg", "DE Shaw", "Amazon"]}
}
},
"Graph Data Structure & Algorithms": {
"Bfs": {
"Smallest sequence with given Primes": {"pts": "200", "tags": ["Booking.com"]},
"Valid Path": {"pts": "200", "tags": ["Morgan Stanley", "Amazon", "Codenation"]},
"Level Order": {"pts": "300", "tags": ["Groupon", "Goldman Sachs"]},
"Smallest Multiple With 0 and 1": {"pts": "300", "tags": ["Amazon"]}
},
"Graph connectivity": {
"Commutable Islands": {"pts": "200", "tags": ["Amazon"]},
"Possibility of finishing all courses given pre-requisites": {"pts": "200", "tags": ["Amazon"]},
"Valid Path": {"pts": "200", "tags": ["Morgan Stanley", "Amazon", "Codenation"]},
"Black Shapes": {"pts": "300", "tags": ["Amazon"]},
"Capture Regions on Board": {"pts": "500"}
},
"Depth first search": {
"Largest Distance between nodes of a Tree": {"pts": "200"}
},
"Graph traversal": {
"Level Order": {"pts": "300", "tags": ["Groupon", "Goldman Sachs"]},
"Stepping Numbers": {"pts": "300", "tags": ["Epic systems"]},
"Capture Regions on Board": {"pts": "500"},
"Word Search Board": {"pts": "500", "tags": ["Epic systems", "Amazon"]}
},
"Graph adhoc": {
"Convert Sorted List to Binary Search Tree": {"pts": "300"}
},
"Shortest path": {
"Sum Of Fibonacci Numbers": {"pts": "300"},
"Knight On Chess Board": {"pts": "300", "tags": ["Goldman Sachs", "Amazon"]},
"Word Ladder I": {"pts": "600", "tags": ["Ebay"]},
"Word Ladder II": {"pts": "800", "tags": ["Ebay"]}
},
"Graph hashing": {
"Clone Graph": {"pts": "500", "tags": ["Amazon"]}
}
},
"Checkpoints" : {
"Level 2" : { "AMORTIZED2" : {} },
"Level 3" : { "PRETTYPRINT" : {} },
"Level 4" : { "Kth Smallest Element in the Array" : {} },
"Level 5" : { "NEXTGREATER" : {},"SUBTRACT" : {} },
"Level 6" : { "Longest Consecutive Sequence" : {} },
"Level 7" : { "INVERSIONS" : {}, "Next Pointer Binary Tree" : {}, "Valid Binary Search Tree" : {} },
"Level 8" : { "Unique Binary Search Trees" : {} },
"Misc" : {
"Middle element of linked list": {},
"Divisor Sequences":{},
"Intersection of Linked Lists":{},
"Reverse Linked List":{}
}
}
};
function setClass(e, set, c) {
set ? e.classList.add(c) : e.classList.remove(c);
}
function toggleClass(e, c) {
e.classList.contains(c) ? e.classList.remove(c) : e.classList.add(c);
}
function toggleNav() {
toggleClass(document.body, 'close');
}
function selectItem(hash, focus, timeout) {
// remove active class from all
var li_ul = root.querySelectorAll("li ul");
for (var i = 1; i < li_ul.length; i++) {
setClass(li_ul[i].parentElement, false, 'active');
}
// select item
for (e of sb.querySelectorAll("li > a")) {
let active = e.href.endsWith(hash);
setClass(e.parentElement, active, 'active');
for (let p = e.parentElement.parentElement; active && p; p = p.parentElement.parentElement) {
setClass(p.parentElement, true, 'active');
}
if (active && focus) {
setTimeout( function(sb,e) {
for (let p = e.parentElement.parentElement; p; p = p.parentElement.parentElement) {
p.style.display = '';
}
sb.parentElement.scrollTop = e.offsetTop - sb.parentElement.clientHeight/2;
}, timeout, sb, e);
}
}
}
function render(hash, focus) {
if (!hash) {
hash = '#programming/arrays/array-math/min-steps-in-infinite-grid';
focus = true;
}
window.location.hash = hash;
let a = hash.replace(/^[^#]*#/gi,'').split('/');
a.splice(2,1)
file = a.join('/') + '.md';
let xhr = new XMLHttpRequest();
xhr.onreadystatechange = function(e) {
if (this.readyState==4) {
let md = document.getElementById('main');
md.innerHTML = this.responseText ? marked(this.responseText) : '404';
let a = this.responseURL.split('/');
let chapter = a[a.length-2].replace(/\b\w/g, l => l.toUpperCase()).replace(/-/gi,' ');
let h1 = md.getElementsByTagName("h1");
top.document.title = h1.length ? h1[0].innerText +' - ' + chapter + ' - MyInterviewBit': '404';
}
};
xhr.open("GET", file, true);
xhr.send();
selectItem(hash, focus, 0);
return false;
}
function add_list(root, name) {
var li = document.createElement("li");
li.innerHTML = '<span>'+name+'</span>';
root.appendChild(li);
var ul = document.createElement("ul");
li.appendChild(ul);
return ul;
}
function add_item(ul, name, tag) {
var li = document.createElement("li");
li.innerHTML = '<a href="#'+tag+'" onclick="render(this.href)">'+name+'</a>';
ul.appendChild(li);
return li;
}
function tagify(s) {
return s.toLowerCase().replace("&",'and').replace("'",'').replace('/','').replace(/[^a-z0-9]+/gi,"-");
}
function init() {
collapsed = true;
sb = document.getElementsByClassName("sidebar-nav")[0];
root = document.createElement("ul");
var base = root;
base = add_list(root, 'Programming');
sb.appendChild(root);
// load sidebar
for ([chapter, panels] of Object.entries(chapters)) {
var list = add_list(base, chapter);
for ([panel, problems] of Object.entries(panels)) {
var sublist = add_list(list, panel);
for ([problem, prop] of Object.entries(problems)) {
let a = add_item(sublist, problem, 'programming/' + tagify(chapter) + '/' + tagify(panel) + '/' + tagify(problem));
if (prop.pts) {
//a.innerHTML += ' ('+prop.pts+')';
}
if (prop.tags) {
a.title = prop.tags.join(', ');
}
}
}
}
var li_ul = root.querySelectorAll("li ul");
for (var i = 0; i < li_ul.length; i++) {
li_ul[i].style.display = collapsed ? 'none' : '';
li_ul[i].parentElement.firstChild.innerText += ' ('+ (li_ul[i].querySelectorAll("li").length - li_ul[i].querySelectorAll("ul").length) + ')';
}
var exp_li = document.querySelectorAll("li > span");
for (var i = 0; i < exp_li.length; i++) {
exp_li[i].style.cursor = "pointer";
exp_li[i].onclick = showul;
}
function showul () {
// click on top item to expand the whole list (mobile devices)
if (this.parentElement.parentElement==root) {
collapsed = !collapsed;
updateItems(collapsed);
return;
}
nextul = this.nextElementSibling;
nextul.style.display = nextul.style.display=='block' ? 'none' : 'block';
}
marked.setOptions({ highlight: function (code, lang) { return lang=='cpp' ? Prism.highlight(code, Prism.languages[lang], lang) : code; }});
render(window.location.hash, true);
function updateItems(collapse, ex) {
var li_ul = root.querySelectorAll("li ul");
for (var i = 1; i < li_ul.length; i++) {
let e = li_ul[i];
let update = !ex || (li_ul[i]!=ex && li_ul[i]!=ex.parentElement.parentElement && li_ul[i]!=ex.parentElement.parentElement.parentElement.parentElement);
if (update) {
e.style.display = collapse ? 'none' : '';
}
}
}
// needs to be rewritten to mvc over chapters
function nextItem(step) {
for (e of sb.querySelectorAll("li > a")) {
if (e.parentElement.classList.contains('active')) {
let sib = null;
let e0 = e;
if (step<0) {
sib = e.parentElement.previousSibling;
if (!sib) {
sib = e.parentElement.parentElement.parentElement.previousSibling;
if (!sib) {
sib = e.parentElement.parentElement.parentElement.parentElement.parentElement.previousSibling.children[1];
sib = sib.children[sib.children.length-1];
}
let chil = sib.children[1].children;
sib = chil[chil.length-1];
}
} else {
sib = e.parentElement.nextSibling;
if (!sib) {
sib = e.parentElement.parentElement.parentElement.nextSibling;
if (!sib) {
sib = e.parentElement.parentElement.parentElement.parentElement.parentElement.nextSibling.children[1].children[0];
}
let chil = sib.children[1].children;
sib = chil[0];
}
}
if (sib) {
e = sib.children[0];
hash = e.href.replace(/^[^#]*#/gi,'#');
}
updateItems(collapsed, e);
render(hash, true, 1);
break;
}
}
}
window.addEventListener("keydown",function (e) {
if (e.keyCode === 70 || e.keyCode === 27) { // F or ESC expands/collapses items
collapsed = e.ctrlKey ? false : !collapsed;
updateItems(collapsed);
selectItem(window.location.hash, true, 0);
} else if (e.keyCode === 37) { // left arrow
nextItem(-1);
} else if (e.keyCode === 39) { // right arrow
nextItem(1);
}
});
}
</script>
</head>
<body onload=init() class="ready sticky">
<a href="https://github.com/joric/interviewbit" class="github-corner" aria-label="View source on Github"><svg viewBox="0 0 250 250" aria-hidden="true"><path d="M0,0 L115,115 L130,115 L142,142 L250,250 L250,0 Z"></path><path d="M128.3,109.0 C113.8,99.7 119.0,89.6 119.0,89.6 C122.0,82.7 120.5,78.6 120.5,78.6 C119.2,72.0 123.4,76.3 123.4,76.3 C127.3,80.9 125.5,87.3 125.5,87.3 C122.9,97.6 130.6,101.9 134.4,103.2" fill="currentColor" style="transform-origin: 130px 106px;" class="octo-arm"></path><path d="M115.0,115.0 C114.9,115.1 118.7,116.5 119.8,115.4 L133.7,101.6 C136.9,99.2 139.9,98.4 142.2,98.6 C133.8,88.0 127.5,74.4 143.8,58.0 C148.5,53.4 154.0,51.2 159.7,51.0 C160.3,49.4 163.2,43.6 171.4,40.1 C171.4,40.1 176.1,42.5 178.8,56.2 C183.1,58.6 187.2,61.8 190.9,65.4 C194.5,69.0 197.7,73.2 200.1,77.6 C213.8,80.2 216.3,84.9 216.3,84.9 C212.7,93.1 206.9,96.0 205.4,96.6 C205.1,102.4 203.0,107.8 198.3,112.5 C181.9,128.9 168.3,122.5 157.7,114.1 C157.9,116.9 156.7,120.9 152.7,124.9 L141.0,136.5 C139.8,137.7 141.6,141.9 141.8,141.8 Z" fill="currentColor" class="octo-body"></path></svg></a>
<main>
<button class="sidebar-toggle">
<div class="sidebar-toggle-button" onclick="toggleNav()">
<span></span>
<span></span>
<span></span>
</div>
</button>
<aside class="sidebar" class="sidebar">
<div class="sidebar-nav"></div>
</aside>
<section class="content">
<article class="markdown-section" id="main"></article>
</section>
</main>
</body>
</html>