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

953 B

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2780Reaching Points29.4%Hard0.08732332033465998https://leetcode.com/problems/reaching-points
357Insert Interval33.5%Hard0.05429184493746532https://leetcode.com/problems/insert-interval
41326Minimum Number of Taps to Open to Water a Garden43.6%Hard0.05224436225718586https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden
5540Single Element in a Sorted Array57.9%Medium0.0192128868599912https://leetcode.com/problems/single-element-in-a-sorted-array
6706Design HashMap61.3%Easy0.01752893260576219https://leetcode.com/problems/design-hashmap
7269Alien Dictionary33.3%Hard0.012730916694039954https://leetcode.com/problems/alien-dictionary
8547Friend Circles58.6%Medium0.012228828639434596https://leetcode.com/problems/friend-circles
9139Word Break40.1%Medium0.003894465052690167https://leetcode.com/problems/word-break