Chore: Add headers to all the files (#54)

## Description
- Add headers to all the CSV files

## Script used
```py
import csv
import os

# Set the path of the folder containing the CSV files
folder_path = "./LeetCode-Questions-CompanyWise"
headers = [
    "ID",
    "Title",
    "Acceptance",
    "Difficulty",
    "Frequency",
    "Leetcode Question Link",
]

# Loop through all the CSV files in the folder
for file_name in os.listdir(folder_path):
    if file_name.endswith(".csv"):
        # Read the CSV file into a list of rows
        file_path = os.path.join(folder_path, file_name)
        with open(file_path, "r") as f:
            reader = csv.reader(f)
            rows = list(reader)

        has_headers = False
        if len(rows) > 0 and rows[0] == headers:
            has_headers = True

        if not has_headers:
            rows.insert(0, headers)

            # Write the list of rows back to the CSV file
            with open(file_path, "w", newline="") as f:
                writer = csv.writer(f)
                writer.writerows(rows)

```
This commit is contained in:
Krishna Kumar Dey
2023-04-01 11:07:49 +05:30
committed by GitHub
parent 0aeadbd612
commit fb5f78b55e
534 changed files with 20291 additions and 19757 deletions

View File

@@ -1,41 +1,42 @@
829,Consecutive Numbers Sum,37.5%,Hard,1.7290600615878309, https://leetcode.com/problems/consecutive-numbers-sum
1048,Longest String Chain,54.7%,Medium,1.016830261064837, https://leetcode.com/problems/longest-string-chain
241,Different Ways to Add Parentheses,55.2%,Medium,0.304600460541843, https://leetcode.com/problems/different-ways-to-add-parentheses
647,Palindromic Substrings,60.6%,Medium,0.19203205445944416, https://leetcode.com/problems/palindromic-substrings
285,Inorder Successor in BST,40.4%,Medium,0.1850469943157836, https://leetcode.com/problems/inorder-successor-in-bst
32,Longest Valid Parentheses,28.4%,Hard,0.13667290598927465, https://leetcode.com/problems/longest-valid-parentheses
935,Knight Dialer,45.2%,Medium,0.09737416402517636, https://leetcode.com/problems/knight-dialer
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.08602309667191627, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
42,Trapping Rain Water,48.9%,Hard,0.08461041545209161, https://leetcode.com/problems/trapping-rain-water
122,Best Time to Buy and Sell Stock II,57.0%,Easy,0.06582927042348097, https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii
221,Maximal Square,37.7%,Medium,0.060244665945199054, https://leetcode.com/problems/maximal-square
20,Valid Parentheses,39.0%,Easy,0.055983722381420686, https://leetcode.com/problems/valid-parentheses
295,Find Median from Data Stream,44.3%,Hard,0.05495888428075748, https://leetcode.com/problems/find-median-from-data-stream
622,Design Circular Queue,43.7%,Medium,0.049844204077291364, https://leetcode.com/problems/design-circular-queue
239,Sliding Window Maximum,43.0%,Hard,0.0483746857022364, https://leetcode.com/problems/sliding-window-maximum
240,Search a 2D Matrix II,43.2%,Medium,0.04647676584572884, https://leetcode.com/problems/search-a-2d-matrix-ii
146,LRU Cache,33.2%,Medium,0.040660598211268925, https://leetcode.com/problems/lru-cache
724,Find Pivot Index,44.0%,Easy,0.03089844155123413, https://leetcode.com/problems/find-pivot-index
332,Reconstruct Itinerary,36.7%,Medium,0.030687713231237448, https://leetcode.com/problems/reconstruct-itinerary
123,Best Time to Buy and Sell Stock III,37.5%,Hard,0.02516207671950806, https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii
199,Binary Tree Right Side View,54.1%,Medium,0.022539339846061532, https://leetcode.com/problems/binary-tree-right-side-view
105,Construct Binary Tree from Preorder and Inorder Traversal,48.8%,Medium,0.022325470299025416, https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
628,Maximum Product of Three Numbers,47.1%,Easy,0.016529301951210565, https://leetcode.com/problems/maximum-product-of-three-numbers
1,Two Sum,45.6%,Easy,0.016487580637467636, https://leetcode.com/problems/two-sum
225,Implement Stack using Queues,45.1%,Easy,0.01644097863345757, https://leetcode.com/problems/implement-stack-using-queues
340,Longest Substring with At Most K Distinct Characters,44.1%,Hard,0.016122880486563188, https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.01585377577217724, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
15,3Sum,26.8%,Medium,0.013665148419080968, https://leetcode.com/problems/3sum
53,Maximum Subarray,46.5%,Easy,0.013467854269413949, https://leetcode.com/problems/maximum-subarray
85,Maximal Rectangle,37.7%,Hard,0.013333530869465187, https://leetcode.com/problems/maximal-rectangle
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
232,Implement Queue using Stacks,49.6%,Easy,0.011242389348933884, https://leetcode.com/problems/implement-queue-using-stacks
212,Word Search II,34.9%,Hard,0.009845021678804893, https://leetcode.com/problems/word-search-ii
70,Climbing Stairs,47.8%,Easy,0.009390798483527519, https://leetcode.com/problems/climbing-stairs
28,Implement strStr(),34.5%,Easy,0.008850485542574548, https://leetcode.com/problems/implement-strstr
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
151,Reverse Words in a String,21.9%,Medium,0.0061359296669270605, https://leetcode.com/problems/reverse-words-in-a-string
8,String to Integer (atoi),15.4%,Medium,0.0037925521897059712, https://leetcode.com/problems/string-to-integer-atoi
102,Binary Tree Level Order Traversal,54.6%,Medium,0.003639014205004082, https://leetcode.com/problems/binary-tree-level-order-traversal
718,Maximum Length of Repeated Subarray,49.4%,Medium,0, https://leetcode.com/problems/maximum-length-of-repeated-subarray
1515,Best Position for a Service Centre,35.9%,Hard,0, https://leetcode.com/problems/best-position-for-a-service-centre
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
829,Consecutive Numbers Sum,37.5%,Hard,1.7290600615878309, https://leetcode.com/problems/consecutive-numbers-sum
1048,Longest String Chain,54.7%,Medium,1.016830261064837, https://leetcode.com/problems/longest-string-chain
241,Different Ways to Add Parentheses,55.2%,Medium,0.304600460541843, https://leetcode.com/problems/different-ways-to-add-parentheses
647,Palindromic Substrings,60.6%,Medium,0.19203205445944416, https://leetcode.com/problems/palindromic-substrings
285,Inorder Successor in BST,40.4%,Medium,0.1850469943157836, https://leetcode.com/problems/inorder-successor-in-bst
32,Longest Valid Parentheses,28.4%,Hard,0.13667290598927465, https://leetcode.com/problems/longest-valid-parentheses
935,Knight Dialer,45.2%,Medium,0.09737416402517636, https://leetcode.com/problems/knight-dialer
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.08602309667191627, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
42,Trapping Rain Water,48.9%,Hard,0.08461041545209161, https://leetcode.com/problems/trapping-rain-water
122,Best Time to Buy and Sell Stock II,57.0%,Easy,0.06582927042348097, https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii
221,Maximal Square,37.7%,Medium,0.060244665945199054, https://leetcode.com/problems/maximal-square
20,Valid Parentheses,39.0%,Easy,0.055983722381420686, https://leetcode.com/problems/valid-parentheses
295,Find Median from Data Stream,44.3%,Hard,0.05495888428075748, https://leetcode.com/problems/find-median-from-data-stream
622,Design Circular Queue,43.7%,Medium,0.049844204077291364, https://leetcode.com/problems/design-circular-queue
239,Sliding Window Maximum,43.0%,Hard,0.0483746857022364, https://leetcode.com/problems/sliding-window-maximum
240,Search a 2D Matrix II,43.2%,Medium,0.04647676584572884, https://leetcode.com/problems/search-a-2d-matrix-ii
146,LRU Cache,33.2%,Medium,0.040660598211268925, https://leetcode.com/problems/lru-cache
724,Find Pivot Index,44.0%,Easy,0.03089844155123413, https://leetcode.com/problems/find-pivot-index
332,Reconstruct Itinerary,36.7%,Medium,0.030687713231237448, https://leetcode.com/problems/reconstruct-itinerary
123,Best Time to Buy and Sell Stock III,37.5%,Hard,0.02516207671950806, https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii
199,Binary Tree Right Side View,54.1%,Medium,0.022539339846061532, https://leetcode.com/problems/binary-tree-right-side-view
105,Construct Binary Tree from Preorder and Inorder Traversal,48.8%,Medium,0.022325470299025416, https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
628,Maximum Product of Three Numbers,47.1%,Easy,0.016529301951210565, https://leetcode.com/problems/maximum-product-of-three-numbers
1,Two Sum,45.6%,Easy,0.016487580637467636, https://leetcode.com/problems/two-sum
225,Implement Stack using Queues,45.1%,Easy,0.01644097863345757, https://leetcode.com/problems/implement-stack-using-queues
340,Longest Substring with At Most K Distinct Characters,44.1%,Hard,0.016122880486563188, https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.01585377577217724, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
15,3Sum,26.8%,Medium,0.013665148419080968, https://leetcode.com/problems/3sum
53,Maximum Subarray,46.5%,Easy,0.013467854269413949, https://leetcode.com/problems/maximum-subarray
85,Maximal Rectangle,37.7%,Hard,0.013333530869465187, https://leetcode.com/problems/maximal-rectangle
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
232,Implement Queue using Stacks,49.6%,Easy,0.011242389348933884, https://leetcode.com/problems/implement-queue-using-stacks
212,Word Search II,34.9%,Hard,0.009845021678804893, https://leetcode.com/problems/word-search-ii
70,Climbing Stairs,47.8%,Easy,0.009390798483527519, https://leetcode.com/problems/climbing-stairs
28,Implement strStr(),34.5%,Easy,0.008850485542574548, https://leetcode.com/problems/implement-strstr
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
151,Reverse Words in a String,21.9%,Medium,0.0061359296669270605, https://leetcode.com/problems/reverse-words-in-a-string
8,String to Integer (atoi),15.4%,Medium,0.0037925521897059712, https://leetcode.com/problems/string-to-integer-atoi
102,Binary Tree Level Order Traversal,54.6%,Medium,0.003639014205004082, https://leetcode.com/problems/binary-tree-level-order-traversal
718,Maximum Length of Repeated Subarray,49.4%,Medium,0, https://leetcode.com/problems/maximum-length-of-repeated-subarray
1515,Best Position for a Service Centre,35.9%,Hard,0, https://leetcode.com/problems/best-position-for-a-service-centre
1 829 ID Consecutive Numbers Sum Title 37.5% Acceptance Hard Difficulty 1.7290600615878309 Frequency https://leetcode.com/problems/consecutive-numbers-sum Leetcode Question Link
2 1048 829 Longest String Chain Consecutive Numbers Sum 54.7% 37.5% Medium Hard 1.016830261064837 1.7290600615878309 https://leetcode.com/problems/longest-string-chain https://leetcode.com/problems/consecutive-numbers-sum
3 241 1048 Different Ways to Add Parentheses Longest String Chain 55.2% 54.7% Medium Medium 0.304600460541843 1.016830261064837 https://leetcode.com/problems/different-ways-to-add-parentheses https://leetcode.com/problems/longest-string-chain
4 647 241 Palindromic Substrings Different Ways to Add Parentheses 60.6% 55.2% Medium Medium 0.19203205445944416 0.304600460541843 https://leetcode.com/problems/palindromic-substrings https://leetcode.com/problems/different-ways-to-add-parentheses
5 285 647 Inorder Successor in BST Palindromic Substrings 40.4% 60.6% Medium Medium 0.1850469943157836 0.19203205445944416 https://leetcode.com/problems/inorder-successor-in-bst https://leetcode.com/problems/palindromic-substrings
6 32 285 Longest Valid Parentheses Inorder Successor in BST 28.4% 40.4% Hard Medium 0.13667290598927465 0.1850469943157836 https://leetcode.com/problems/longest-valid-parentheses https://leetcode.com/problems/inorder-successor-in-bst
7 935 32 Knight Dialer Longest Valid Parentheses 45.2% 28.4% Medium Hard 0.09737416402517636 0.13667290598927465 https://leetcode.com/problems/knight-dialer https://leetcode.com/problems/longest-valid-parentheses
8 121 935 Best Time to Buy and Sell Stock Knight Dialer 50.5% 45.2% Easy Medium 0.08602309667191627 0.09737416402517636 https://leetcode.com/problems/best-time-to-buy-and-sell-stock https://leetcode.com/problems/knight-dialer
9 42 121 Trapping Rain Water Best Time to Buy and Sell Stock 48.9% 50.5% Hard Easy 0.08461041545209161 0.08602309667191627 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/best-time-to-buy-and-sell-stock
10 122 42 Best Time to Buy and Sell Stock II Trapping Rain Water 57.0% 48.9% Easy Hard 0.06582927042348097 0.08461041545209161 https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii https://leetcode.com/problems/trapping-rain-water
11 221 122 Maximal Square Best Time to Buy and Sell Stock II 37.7% 57.0% Medium Easy 0.060244665945199054 0.06582927042348097 https://leetcode.com/problems/maximal-square https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii
12 20 221 Valid Parentheses Maximal Square 39.0% 37.7% Easy Medium 0.055983722381420686 0.060244665945199054 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/maximal-square
13 295 20 Find Median from Data Stream Valid Parentheses 44.3% 39.0% Hard Easy 0.05495888428075748 0.055983722381420686 https://leetcode.com/problems/find-median-from-data-stream https://leetcode.com/problems/valid-parentheses
14 622 295 Design Circular Queue Find Median from Data Stream 43.7% 44.3% Medium Hard 0.049844204077291364 0.05495888428075748 https://leetcode.com/problems/design-circular-queue https://leetcode.com/problems/find-median-from-data-stream
15 239 622 Sliding Window Maximum Design Circular Queue 43.0% 43.7% Hard Medium 0.0483746857022364 0.049844204077291364 https://leetcode.com/problems/sliding-window-maximum https://leetcode.com/problems/design-circular-queue
16 240 239 Search a 2D Matrix II Sliding Window Maximum 43.2% 43.0% Medium Hard 0.04647676584572884 0.0483746857022364 https://leetcode.com/problems/search-a-2d-matrix-ii https://leetcode.com/problems/sliding-window-maximum
17 146 240 LRU Cache Search a 2D Matrix II 33.2% 43.2% Medium Medium 0.040660598211268925 0.04647676584572884 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/search-a-2d-matrix-ii
18 724 146 Find Pivot Index LRU Cache 44.0% 33.2% Easy Medium 0.03089844155123413 0.040660598211268925 https://leetcode.com/problems/find-pivot-index https://leetcode.com/problems/lru-cache
19 332 724 Reconstruct Itinerary Find Pivot Index 36.7% 44.0% Medium Easy 0.030687713231237448 0.03089844155123413 https://leetcode.com/problems/reconstruct-itinerary https://leetcode.com/problems/find-pivot-index
20 123 332 Best Time to Buy and Sell Stock III Reconstruct Itinerary 37.5% 36.7% Hard Medium 0.02516207671950806 0.030687713231237448 https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii https://leetcode.com/problems/reconstruct-itinerary
21 199 123 Binary Tree Right Side View Best Time to Buy and Sell Stock III 54.1% 37.5% Medium Hard 0.022539339846061532 0.02516207671950806 https://leetcode.com/problems/binary-tree-right-side-view https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii
22 105 199 Construct Binary Tree from Preorder and Inorder Traversal Binary Tree Right Side View 48.8% 54.1% Medium Medium 0.022325470299025416 0.022539339846061532 https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal https://leetcode.com/problems/binary-tree-right-side-view
23 628 105 Maximum Product of Three Numbers Construct Binary Tree from Preorder and Inorder Traversal 47.1% 48.8% Easy Medium 0.016529301951210565 0.022325470299025416 https://leetcode.com/problems/maximum-product-of-three-numbers https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
24 1 628 Two Sum Maximum Product of Three Numbers 45.6% 47.1% Easy Easy 0.016487580637467636 0.016529301951210565 https://leetcode.com/problems/two-sum https://leetcode.com/problems/maximum-product-of-three-numbers
25 225 1 Implement Stack using Queues Two Sum 45.1% 45.6% Easy Easy 0.01644097863345757 0.016487580637467636 https://leetcode.com/problems/implement-stack-using-queues https://leetcode.com/problems/two-sum
26 340 225 Longest Substring with At Most K Distinct Characters Implement Stack using Queues 44.1% 45.1% Hard Easy 0.016122880486563188 0.01644097863345757 https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters https://leetcode.com/problems/implement-stack-using-queues
27 297 340 Serialize and Deserialize Binary Tree Longest Substring with At Most K Distinct Characters 47.5% 44.1% Hard Hard 0.01585377577217724 0.016122880486563188 https://leetcode.com/problems/serialize-and-deserialize-binary-tree https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters
28 15 297 3Sum Serialize and Deserialize Binary Tree 26.8% 47.5% Medium Hard 0.013665148419080968 0.01585377577217724 https://leetcode.com/problems/3sum https://leetcode.com/problems/serialize-and-deserialize-binary-tree
29 53 15 Maximum Subarray 3Sum 46.5% 26.8% Easy Medium 0.013467854269413949 0.013665148419080968 https://leetcode.com/problems/maximum-subarray https://leetcode.com/problems/3sum
30 85 53 Maximal Rectangle Maximum Subarray 37.7% 46.5% Hard Easy 0.013333530869465187 0.013467854269413949 https://leetcode.com/problems/maximal-rectangle https://leetcode.com/problems/maximum-subarray
31 200 85 Number of Islands Maximal Rectangle 46.8% 37.7% Medium Hard 0.011509262420590827 0.013333530869465187 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/maximal-rectangle
32 232 200 Implement Queue using Stacks Number of Islands 49.6% 46.8% Easy Medium 0.011242389348933884 0.011509262420590827 https://leetcode.com/problems/implement-queue-using-stacks https://leetcode.com/problems/number-of-islands
33 212 232 Word Search II Implement Queue using Stacks 34.9% 49.6% Hard Easy 0.009845021678804893 0.011242389348933884 https://leetcode.com/problems/word-search-ii https://leetcode.com/problems/implement-queue-using-stacks
34 70 212 Climbing Stairs Word Search II 47.8% 34.9% Easy Hard 0.009390798483527519 0.009845021678804893 https://leetcode.com/problems/climbing-stairs https://leetcode.com/problems/word-search-ii
35 28 70 Implement strStr() Climbing Stairs 34.5% 47.8% Easy Easy 0.008850485542574548 0.009390798483527519 https://leetcode.com/problems/implement-strstr https://leetcode.com/problems/climbing-stairs
36 253 28 Meeting Rooms II Implement strStr() 45.7% 34.5% Medium Easy 0.008079219870546493 0.008850485542574548 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/implement-strstr
37 151 253 Reverse Words in a String Meeting Rooms II 21.9% 45.7% Medium Medium 0.0061359296669270605 0.008079219870546493 https://leetcode.com/problems/reverse-words-in-a-string https://leetcode.com/problems/meeting-rooms-ii
38 8 151 String to Integer (atoi) Reverse Words in a String 15.4% 21.9% Medium Medium 0.0037925521897059712 0.0061359296669270605 https://leetcode.com/problems/string-to-integer-atoi https://leetcode.com/problems/reverse-words-in-a-string
39 102 8 Binary Tree Level Order Traversal String to Integer (atoi) 54.6% 15.4% Medium Medium 0.003639014205004082 0.0037925521897059712 https://leetcode.com/problems/binary-tree-level-order-traversal https://leetcode.com/problems/string-to-integer-atoi
40 718 102 Maximum Length of Repeated Subarray Binary Tree Level Order Traversal 49.4% 54.6% Medium Medium 0 0.003639014205004082 https://leetcode.com/problems/maximum-length-of-repeated-subarray https://leetcode.com/problems/binary-tree-level-order-traversal
41 1515 718 Best Position for a Service Centre Maximum Length of Repeated Subarray 35.9% 49.4% Hard Medium 0 0 https://leetcode.com/problems/best-position-for-a-service-centre https://leetcode.com/problems/maximum-length-of-repeated-subarray
42 1515 Best Position for a Service Centre 35.9% Hard 0 https://leetcode.com/problems/best-position-for-a-service-centre