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,8 +1,9 @@
1359,Count All Valid Pickup and Delivery Options,57.9%,Hard,0.261487798668764, https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
695,Max Area of Island,62.7%,Medium,0.22890365856149725, https://leetcode.com/problems/max-area-of-island
759,Employee Free Time,66.3%,Hard,0.16790196801661988, https://leetcode.com/problems/employee-free-time
1229,Meeting Scheduler,52.7%,Medium,0.09305870395398054, https://leetcode.com/problems/meeting-scheduler
37,Sudoku Solver,43.6%,Hard,0.01821543989134118, https://leetcode.com/problems/sudoku-solver
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
56,Merge Intervals,39.3%,Medium,0.0034728286335985107, https://leetcode.com/problems/merge-intervals
210,Course Schedule II,40.7%,Medium,0.0019086707135282834, https://leetcode.com/problems/course-schedule-ii
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1359,Count All Valid Pickup and Delivery Options,57.9%,Hard,0.261487798668764, https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
695,Max Area of Island,62.7%,Medium,0.22890365856149725, https://leetcode.com/problems/max-area-of-island
759,Employee Free Time,66.3%,Hard,0.16790196801661988, https://leetcode.com/problems/employee-free-time
1229,Meeting Scheduler,52.7%,Medium,0.09305870395398054, https://leetcode.com/problems/meeting-scheduler
37,Sudoku Solver,43.6%,Hard,0.01821543989134118, https://leetcode.com/problems/sudoku-solver
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
56,Merge Intervals,39.3%,Medium,0.0034728286335985107, https://leetcode.com/problems/merge-intervals
210,Course Schedule II,40.7%,Medium,0.0019086707135282834, https://leetcode.com/problems/course-schedule-ii
1 1359 ID Count All Valid Pickup and Delivery Options Title 57.9% Acceptance Hard Difficulty 0.261487798668764 Frequency https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options Leetcode Question Link
2 695 1359 Max Area of Island Count All Valid Pickup and Delivery Options 62.7% 57.9% Medium Hard 0.22890365856149725 0.261487798668764 https://leetcode.com/problems/max-area-of-island https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
3 759 695 Employee Free Time Max Area of Island 66.3% 62.7% Hard Medium 0.16790196801661988 0.22890365856149725 https://leetcode.com/problems/employee-free-time https://leetcode.com/problems/max-area-of-island
4 1229 759 Meeting Scheduler Employee Free Time 52.7% 66.3% Medium Hard 0.09305870395398054 0.16790196801661988 https://leetcode.com/problems/meeting-scheduler https://leetcode.com/problems/employee-free-time
5 37 1229 Sudoku Solver Meeting Scheduler 43.6% 52.7% Hard Medium 0.01821543989134118 0.09305870395398054 https://leetcode.com/problems/sudoku-solver https://leetcode.com/problems/meeting-scheduler
6 227 37 Basic Calculator II Sudoku Solver 36.9% 43.6% Medium Hard 0.01239941490503826 0.01821543989134118 https://leetcode.com/problems/basic-calculator-ii https://leetcode.com/problems/sudoku-solver
7 56 227 Merge Intervals Basic Calculator II 39.3% 36.9% Medium Medium 0.0034728286335985107 0.01239941490503826 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/basic-calculator-ii
8 210 56 Course Schedule II Merge Intervals 40.7% 39.3% Medium Medium 0.0019086707135282834 0.0034728286335985107 https://leetcode.com/problems/course-schedule-ii https://leetcode.com/problems/merge-intervals
9 210 Course Schedule II 40.7% Medium 0.0019086707135282834 https://leetcode.com/problems/course-schedule-ii