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,25 +1,26 @@
312,Burst Balloons,51.8%,Hard,0.1436030350715959, https://leetcode.com/problems/burst-balloons
1,Two Sum,45.6%,Easy,0.10724153306109706, https://leetcode.com/problems/two-sum
572,Subtree of Another Tree,44.1%,Easy,0.08694829147719678, https://leetcode.com/problems/subtree-of-another-tree
31,Next Permutation,32.6%,Medium,0.05058678946669793, https://leetcode.com/problems/next-permutation
85,Maximal Rectangle,37.7%,Hard,0.050135812424355455, https://leetcode.com/problems/maximal-rectangle
20,Valid Parentheses,39.0%,Easy,0.04358808999497224, https://leetcode.com/problems/valid-parentheses
32,Longest Valid Parentheses,28.4%,Hard,0.03477099521294092, https://leetcode.com/problems/longest-valid-parentheses
15,3Sum,26.8%,Medium,0.03278982282299087, https://leetcode.com/problems/3sum
18,4Sum,33.7%,Medium,0.02090668481931367, https://leetcode.com/problems/4sum
33,Search in Rotated Sorted Array,34.5%,Medium,0.019219533793635182, https://leetcode.com/problems/search-in-rotated-sorted-array
22,Generate Parentheses,62.7%,Medium,0.016507132273019587, https://leetcode.com/problems/generate-parentheses
876,Middle of the Linked List,68.4%,Easy,0.01631061893137506, https://leetcode.com/problems/middle-of-the-linked-list
5,Longest Palindromic Substring,29.5%,Medium,0.013529809159515602, https://leetcode.com/problems/longest-palindromic-substring
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.013288251045064422, https://leetcode.com/problems/longest-substring-without-repeating-characters
523,Continuous Subarray Sum,24.6%,Medium,0.011293174793455513, https://leetcode.com/problems/continuous-subarray-sum
103,Binary Tree Zigzag Level Order Traversal,48.3%,Medium,0.010504298266876018, https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
190,Reverse Bits,39.8%,Easy,0.007245095991891571, https://leetcode.com/problems/reverse-bits
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
21,Merge Two Sorted Lists,53.5%,Easy,0.004849147433009811, https://leetcode.com/problems/merge-two-sorted-lists
653,Two Sum IV - Input is a BST,55.5%,Easy,0, https://leetcode.com/problems/two-sum-iv-input-is-a-bst
987,Vertical Order Traversal of a Binary Tree,36.6%,Medium,0, https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree
1301,Number of Paths with Max Score,37.3%,Hard,0, https://leetcode.com/problems/number-of-paths-with-max-score
1139,Largest 1-Bordered Square,47.5%,Medium,0, https://leetcode.com/problems/largest-1-bordered-square
1464,Maximum Product of Two Elements in an Array,78.1%,Easy,0, https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array
1519,Number of Nodes in the Sub-Tree With the Same Label,35.2%,Medium,0, https://leetcode.com/problems/number-of-nodes-in-the-sub-tree-with-the-same-label
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
312,Burst Balloons,51.8%,Hard,0.1436030350715959, https://leetcode.com/problems/burst-balloons
1,Two Sum,45.6%,Easy,0.10724153306109706, https://leetcode.com/problems/two-sum
572,Subtree of Another Tree,44.1%,Easy,0.08694829147719678, https://leetcode.com/problems/subtree-of-another-tree
31,Next Permutation,32.6%,Medium,0.05058678946669793, https://leetcode.com/problems/next-permutation
85,Maximal Rectangle,37.7%,Hard,0.050135812424355455, https://leetcode.com/problems/maximal-rectangle
20,Valid Parentheses,39.0%,Easy,0.04358808999497224, https://leetcode.com/problems/valid-parentheses
32,Longest Valid Parentheses,28.4%,Hard,0.03477099521294092, https://leetcode.com/problems/longest-valid-parentheses
15,3Sum,26.8%,Medium,0.03278982282299087, https://leetcode.com/problems/3sum
18,4Sum,33.7%,Medium,0.02090668481931367, https://leetcode.com/problems/4sum
33,Search in Rotated Sorted Array,34.5%,Medium,0.019219533793635182, https://leetcode.com/problems/search-in-rotated-sorted-array
22,Generate Parentheses,62.7%,Medium,0.016507132273019587, https://leetcode.com/problems/generate-parentheses
876,Middle of the Linked List,68.4%,Easy,0.01631061893137506, https://leetcode.com/problems/middle-of-the-linked-list
5,Longest Palindromic Substring,29.5%,Medium,0.013529809159515602, https://leetcode.com/problems/longest-palindromic-substring
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.013288251045064422, https://leetcode.com/problems/longest-substring-without-repeating-characters
523,Continuous Subarray Sum,24.6%,Medium,0.011293174793455513, https://leetcode.com/problems/continuous-subarray-sum
103,Binary Tree Zigzag Level Order Traversal,48.3%,Medium,0.010504298266876018, https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
190,Reverse Bits,39.8%,Easy,0.007245095991891571, https://leetcode.com/problems/reverse-bits
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
21,Merge Two Sorted Lists,53.5%,Easy,0.004849147433009811, https://leetcode.com/problems/merge-two-sorted-lists
653,Two Sum IV - Input is a BST,55.5%,Easy,0, https://leetcode.com/problems/two-sum-iv-input-is-a-bst
987,Vertical Order Traversal of a Binary Tree,36.6%,Medium,0, https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree
1301,Number of Paths with Max Score,37.3%,Hard,0, https://leetcode.com/problems/number-of-paths-with-max-score
1139,Largest 1-Bordered Square,47.5%,Medium,0, https://leetcode.com/problems/largest-1-bordered-square
1464,Maximum Product of Two Elements in an Array,78.1%,Easy,0, https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array
1519,Number of Nodes in the Sub-Tree With the Same Label,35.2%,Medium,0, https://leetcode.com/problems/number-of-nodes-in-the-sub-tree-with-the-same-label
1 312 ID Burst Balloons Title 51.8% Acceptance Hard Difficulty 0.1436030350715959 Frequency https://leetcode.com/problems/burst-balloons Leetcode Question Link
2 1 312 Two Sum Burst Balloons 45.6% 51.8% Easy Hard 0.10724153306109706 0.1436030350715959 https://leetcode.com/problems/two-sum https://leetcode.com/problems/burst-balloons
3 572 1 Subtree of Another Tree Two Sum 44.1% 45.6% Easy Easy 0.08694829147719678 0.10724153306109706 https://leetcode.com/problems/subtree-of-another-tree https://leetcode.com/problems/two-sum
4 31 572 Next Permutation Subtree of Another Tree 32.6% 44.1% Medium Easy 0.05058678946669793 0.08694829147719678 https://leetcode.com/problems/next-permutation https://leetcode.com/problems/subtree-of-another-tree
5 85 31 Maximal Rectangle Next Permutation 37.7% 32.6% Hard Medium 0.050135812424355455 0.05058678946669793 https://leetcode.com/problems/maximal-rectangle https://leetcode.com/problems/next-permutation
6 20 85 Valid Parentheses Maximal Rectangle 39.0% 37.7% Easy Hard 0.04358808999497224 0.050135812424355455 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/maximal-rectangle
7 32 20 Longest Valid Parentheses Valid Parentheses 28.4% 39.0% Hard Easy 0.03477099521294092 0.04358808999497224 https://leetcode.com/problems/longest-valid-parentheses https://leetcode.com/problems/valid-parentheses
8 15 32 3Sum Longest Valid Parentheses 26.8% 28.4% Medium Hard 0.03278982282299087 0.03477099521294092 https://leetcode.com/problems/3sum https://leetcode.com/problems/longest-valid-parentheses
9 18 15 4Sum 3Sum 33.7% 26.8% Medium Medium 0.02090668481931367 0.03278982282299087 https://leetcode.com/problems/4sum https://leetcode.com/problems/3sum
10 33 18 Search in Rotated Sorted Array 4Sum 34.5% 33.7% Medium Medium 0.019219533793635182 0.02090668481931367 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/4sum
11 22 33 Generate Parentheses Search in Rotated Sorted Array 62.7% 34.5% Medium Medium 0.016507132273019587 0.019219533793635182 https://leetcode.com/problems/generate-parentheses https://leetcode.com/problems/search-in-rotated-sorted-array
12 876 22 Middle of the Linked List Generate Parentheses 68.4% 62.7% Easy Medium 0.01631061893137506 0.016507132273019587 https://leetcode.com/problems/middle-of-the-linked-list https://leetcode.com/problems/generate-parentheses
13 5 876 Longest Palindromic Substring Middle of the Linked List 29.5% 68.4% Medium Easy 0.013529809159515602 0.01631061893137506 https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/middle-of-the-linked-list
14 3 5 Longest Substring Without Repeating Characters Longest Palindromic Substring 30.4% 29.5% Medium Medium 0.013288251045064422 0.013529809159515602 https://leetcode.com/problems/longest-substring-without-repeating-characters https://leetcode.com/problems/longest-palindromic-substring
15 523 3 Continuous Subarray Sum Longest Substring Without Repeating Characters 24.6% 30.4% Medium Medium 0.011293174793455513 0.013288251045064422 https://leetcode.com/problems/continuous-subarray-sum https://leetcode.com/problems/longest-substring-without-repeating-characters
16 103 523 Binary Tree Zigzag Level Order Traversal Continuous Subarray Sum 48.3% 24.6% Medium Medium 0.010504298266876018 0.011293174793455513 https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal https://leetcode.com/problems/continuous-subarray-sum
17 190 103 Reverse Bits Binary Tree Zigzag Level Order Traversal 39.8% 48.3% Easy Medium 0.007245095991891571 0.010504298266876018 https://leetcode.com/problems/reverse-bits https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
18 127 190 Word Ladder Reverse Bits 29.6% 39.8% Medium Easy 0.005731495844689608 0.007245095991891571 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/reverse-bits
19 21 127 Merge Two Sorted Lists Word Ladder 53.5% 29.6% Easy Medium 0.004849147433009811 0.005731495844689608 https://leetcode.com/problems/merge-two-sorted-lists https://leetcode.com/problems/word-ladder
20 653 21 Two Sum IV - Input is a BST Merge Two Sorted Lists 55.5% 53.5% Easy Easy 0 0.004849147433009811 https://leetcode.com/problems/two-sum-iv-input-is-a-bst https://leetcode.com/problems/merge-two-sorted-lists
21 987 653 Vertical Order Traversal of a Binary Tree Two Sum IV - Input is a BST 36.6% 55.5% Medium Easy 0 0 https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree https://leetcode.com/problems/two-sum-iv-input-is-a-bst
22 1301 987 Number of Paths with Max Score Vertical Order Traversal of a Binary Tree 37.3% 36.6% Hard Medium 0 0 https://leetcode.com/problems/number-of-paths-with-max-score https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree
23 1139 1301 Largest 1-Bordered Square Number of Paths with Max Score 47.5% 37.3% Medium Hard 0 0 https://leetcode.com/problems/largest-1-bordered-square https://leetcode.com/problems/number-of-paths-with-max-score
24 1464 1139 Maximum Product of Two Elements in an Array Largest 1-Bordered Square 78.1% 47.5% Easy Medium 0 0 https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array https://leetcode.com/problems/largest-1-bordered-square
25 1519 1464 Number of Nodes in the Sub-Tree With the Same Label Maximum Product of Two Elements in an Array 35.2% 78.1% Medium Easy 0 0 https://leetcode.com/problems/number-of-nodes-in-the-sub-tree-with-the-same-label https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array
26 1519 Number of Nodes in the Sub-Tree With the Same Label 35.2% Medium 0 https://leetcode.com/problems/number-of-nodes-in-the-sub-tree-with-the-same-label