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,15 +1,16 @@
1228,Missing Number In Arithmetic Progression,52.6%,Easy,0.14893621100754167, https://leetcode.com/problems/missing-number-in-arithmetic-progression
545,Boundary of Binary Tree,38.9%,Medium,0.0877756108823857, https://leetcode.com/problems/boundary-of-binary-tree
472,Concatenated Words,43.7%,Hard,0.026615010757229714, https://leetcode.com/problems/concatenated-words
140,Word Break II,32.6%,Hard,0.01660836687673306, https://leetcode.com/problems/word-break-ii
73,Set Matrix Zeroes,43.1%,Medium,0.015010288493889185, https://leetcode.com/problems/set-matrix-zeroes
200,Number of Islands,46.8%,Medium,0.011015601921505717, https://leetcode.com/problems/number-of-islands
139,Word Break,40.1%,Medium,0.008429383994401785, https://leetcode.com/problems/word-break
937,Reorder Data in Log Files,54.3%,Easy,0.00802733590076424, https://leetcode.com/problems/reorder-data-in-log-files
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
23,Merge k Sorted Lists,40.2%,Hard,0.0038759738446929853, https://leetcode.com/problems/merge-k-sorted-lists
101,Symmetric Tree,46.8%,Easy,0.0032666423495169026, https://leetcode.com/problems/symmetric-tree
20,Valid Parentheses,39.0%,Easy,0.002197682330605871, https://leetcode.com/problems/valid-parentheses
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0020383211296970956, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
1,Two Sum,45.6%,Easy,0.001767235914611495, https://leetcode.com/problems/two-sum
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1228,Missing Number In Arithmetic Progression,52.6%,Easy,0.14893621100754167, https://leetcode.com/problems/missing-number-in-arithmetic-progression
545,Boundary of Binary Tree,38.9%,Medium,0.0877756108823857, https://leetcode.com/problems/boundary-of-binary-tree
472,Concatenated Words,43.7%,Hard,0.026615010757229714, https://leetcode.com/problems/concatenated-words
140,Word Break II,32.6%,Hard,0.01660836687673306, https://leetcode.com/problems/word-break-ii
73,Set Matrix Zeroes,43.1%,Medium,0.015010288493889185, https://leetcode.com/problems/set-matrix-zeroes
200,Number of Islands,46.8%,Medium,0.011015601921505717, https://leetcode.com/problems/number-of-islands
139,Word Break,40.1%,Medium,0.008429383994401785, https://leetcode.com/problems/word-break
937,Reorder Data in Log Files,54.3%,Easy,0.00802733590076424, https://leetcode.com/problems/reorder-data-in-log-files
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
23,Merge k Sorted Lists,40.2%,Hard,0.0038759738446929853, https://leetcode.com/problems/merge-k-sorted-lists
101,Symmetric Tree,46.8%,Easy,0.0032666423495169026, https://leetcode.com/problems/symmetric-tree
20,Valid Parentheses,39.0%,Easy,0.002197682330605871, https://leetcode.com/problems/valid-parentheses
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0020383211296970956, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
1,Two Sum,45.6%,Easy,0.001767235914611495, https://leetcode.com/problems/two-sum
1 1228 ID Missing Number In Arithmetic Progression Title 52.6% Acceptance Easy Difficulty 0.14893621100754167 Frequency https://leetcode.com/problems/missing-number-in-arithmetic-progression Leetcode Question Link
2 545 1228 Boundary of Binary Tree Missing Number In Arithmetic Progression 38.9% 52.6% Medium Easy 0.0877756108823857 0.14893621100754167 https://leetcode.com/problems/boundary-of-binary-tree https://leetcode.com/problems/missing-number-in-arithmetic-progression
3 472 545 Concatenated Words Boundary of Binary Tree 43.7% 38.9% Hard Medium 0.026615010757229714 0.0877756108823857 https://leetcode.com/problems/concatenated-words https://leetcode.com/problems/boundary-of-binary-tree
4 140 472 Word Break II Concatenated Words 32.6% 43.7% Hard Hard 0.01660836687673306 0.026615010757229714 https://leetcode.com/problems/word-break-ii https://leetcode.com/problems/concatenated-words
5 73 140 Set Matrix Zeroes Word Break II 43.1% 32.6% Medium Hard 0.015010288493889185 0.01660836687673306 https://leetcode.com/problems/set-matrix-zeroes https://leetcode.com/problems/word-break-ii
6 200 73 Number of Islands Set Matrix Zeroes 46.8% 43.1% Medium Medium 0.011015601921505717 0.015010288493889185 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/set-matrix-zeroes
7 139 200 Word Break Number of Islands 40.1% 46.8% Medium Medium 0.008429383994401785 0.011015601921505717 https://leetcode.com/problems/word-break https://leetcode.com/problems/number-of-islands
8 937 139 Reorder Data in Log Files Word Break 54.3% 40.1% Easy Medium 0.00802733590076424 0.008429383994401785 https://leetcode.com/problems/reorder-data-in-log-files https://leetcode.com/problems/word-break
9 127 937 Word Ladder Reorder Data in Log Files 29.6% 54.3% Medium Easy 0.005731495844689608 0.00802733590076424 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/reorder-data-in-log-files
10 42 127 Trapping Rain Water Word Ladder 48.9% 29.6% Hard Medium 0.00411947029523883 0.005731495844689608 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/word-ladder
11 23 42 Merge k Sorted Lists Trapping Rain Water 40.2% 48.9% Hard Hard 0.0038759738446929853 0.00411947029523883 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/trapping-rain-water
12 101 23 Symmetric Tree Merge k Sorted Lists 46.8% 40.2% Easy Hard 0.0032666423495169026 0.0038759738446929853 https://leetcode.com/problems/symmetric-tree https://leetcode.com/problems/merge-k-sorted-lists
13 20 101 Valid Parentheses Symmetric Tree 39.0% 46.8% Easy Easy 0.002197682330605871 0.0032666423495169026 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/symmetric-tree
14 121 20 Best Time to Buy and Sell Stock Valid Parentheses 50.5% 39.0% Easy Easy 0.0020383211296970956 0.002197682330605871 https://leetcode.com/problems/best-time-to-buy-and-sell-stock https://leetcode.com/problems/valid-parentheses
15 1 121 Two Sum Best Time to Buy and Sell Stock 45.6% 50.5% Easy Easy 0.001767235914611495 0.0020383211296970956 https://leetcode.com/problems/two-sum https://leetcode.com/problems/best-time-to-buy-and-sell-stock
16 1 Two Sum 45.6% Easy 0.001767235914611495 https://leetcode.com/problems/two-sum