LeetCode-Questions-CompanyWise/dropbox_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

994 B

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2609Find Duplicate File in System59.5%Medium2.404143967080495https://leetcode.com/problems/find-duplicate-file-in-system
3289Game of Life54.5%Medium1.699930916292986https://leetcode.com/problems/game-of-life
4379Design Phone Directory46.8%Medium0.9957178655054769https://leetcode.com/problems/design-phone-directory
51242Web Crawler Multithreaded45.9%Medium0.8967461358011848https://leetcode.com/problems/web-crawler-multithreaded
61178Number of Valid Words for Each Puzzle37.8%Hard0.8109302162163288https://leetcode.com/problems/number-of-valid-words-for-each-puzzle
7642Design Search Autocomplete System44.7%Hard0.43349242036282026https://leetcode.com/problems/design-search-autocomplete-system
8146LRU Cache33.2%Medium0.1090999130829226https://leetcode.com/problems/lru-cache
9362Design Hit Counter63.7%Medium0.025382073271417165https://leetcode.com/problems/design-hit-counter