LeetCode-Questions-CompanyWise/doordash_1year.csv
Krishna Kumar Dey fb5f78b55e
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)

```
2023-04-01 11:07:49 +05:30

1.6 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2759Employee Free Time66.3%Hard0.8067517126995383https://leetcode.com/problems/employee-free-time
3695Max Area of Island62.7%Medium0.7079785078050851https://leetcode.com/problems/max-area-of-island
41229Meeting Scheduler52.7%Medium0.5152176154540078https://leetcode.com/problems/meeting-scheduler
51359Count All Valid Pickup and Delivery Options57.9%Hard0.4639892692240469https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
6355Design Twitter30.3%Medium0.3183174263408411https://leetcode.com/problems/design-twitter
71174Immediate Food Delivery II58.5%Medium0.12555653398976382https://leetcode.com/problems/immediate-food-delivery-ii
81173Immediate Food Delivery I80.4%Easy0.06592172080482424https://leetcode.com/problems/immediate-food-delivery-i
937Sudoku Solver43.6%Hard0.01821543989134118https://leetcode.com/problems/sudoku-solver
10210Course Schedule II40.7%Medium0.01704828902223426https://leetcode.com/problems/course-schedule-ii
1156Merge Intervals39.3%Medium0.013819532422258866https://leetcode.com/problems/merge-intervals
12227Basic Calculator II36.9%Medium0.01239941490503826https://leetcode.com/problems/basic-calculator-ii
1336Valid Sudoku48.7%Medium0.007258242715805398https://leetcode.com/problems/valid-sudoku
14153Sum26.8%Medium0.004940992758742591https://leetcode.com/problems/3sum
15121Best Time to Buy and Sell Stock50.5%Easy0.0047725193990346675https://leetcode.com/problems/best-time-to-buy-and-sell-stock
16146LRU Cache33.2%Medium0.004600353139061353https://leetcode.com/problems/lru-cache