-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathproblems.txt
More file actions
60 lines (43 loc) · 2.64 KB
/
Copy pathproblems.txt
File metadata and controls
60 lines (43 loc) · 2.64 KB
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
********************************Arrays**********************************
Count subarray sum equal k (+ve/-ve) -> Prefix Sum
Count subarray sum equal k (+ve) -> Sliding Window -> pending
Longest subarray sum equals k (+ve) -> Sliding Window
Longest subarry sum equals k (+ve/-ve) -> Prefix Sum
Longest subarray sum equals 0(+ve/-ve) -> Prefix Sum
Smallest subarray sum equals 0(+ve/-ve) -> Prefix Sum -> Pending
Count subarrays sum equals 0(+ve/-ve) -> Prefix Sum -> Pending
Smallest subarray with sum equals k (+ve) -> Pending
Smallest subarray with sum equals k (+ve/-ve) -> Prefix Sum
Total number of zero filled subarrays -> Count all zeros and apply formula
Longest zero filled subarry -> Pending
Smallest subarray with sum >= k -> Sliding window (Dynamic Size)
Smallest subarray with sum <= k -> Pending
Max sum of distinct subarray with length k -> Sliding window (Fixed Size)
Min sum of distinct subarray with length k -> Sliding window (Fixed Size)
Contigous subarray whose length equals k which has max average value -> Sliding window (Fixed Size)
Contigous subarray whose length equals k which has min average value -> Sliding window (Fixed Size) -> Pending
Longest subarray with distinct elements -> Pending
Smallest subarray with distinct elements -> Pending
Count subarray with distinct elements -> Pending
Subarray with distinct elements -> Pending
Subarray sum equals k with distinct elements -> Pending
Binary subarray with sum equals k -> Sliding window (Dynamic Size), Count 1's
Count contigous subarrays with total number of odd nums equals k -> Sliding window (Dynamic Size), Count odd numbers
Max consecutive ones -> Sliding window (Dynamic Size)
Longest consecutive subarray with equal number of zero and one -> HashMap
Find duplicate in array of n+1 integers -> Sorting
Nums that appears once and others twice -> XOR
Majority elements -> Frequency of Nums
Move zeros -> Swapping
Product of array except self -> Prefix Suffix
Rotate array by k elements -> Reverse entire array then first k elements then remaning elements
Two Sum -> Array(Not necessarily consecutive) of length two whose sum equals k -> HashMap
Length of longest consecutive sequence of numbers in array -> Set
Union of two sorted arrays -> Two pointer approach
Merge two sorted arrays into frist array (In Place)
********************************String**********************************
Add binary
Longest repeating character replacement -> Sliding window (Dynamic Size)
Longest substring without repeating characters -> Sliding window (Dynamic Size)
Number of substring containing all three characters -> Sliding window (Dynamic Size)
Find all anagramns in string -> Sliding window (Fixed Size)