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

1.0 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
21283Find the Smallest Divisor Given a Threshold47.6%Medium0.030152736302452396https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold
3348Design Tic-Tac-Toe54.3%Medium0.024214258120594613https://leetcode.com/problems/design-tic-tac-toe
4146LRU Cache33.2%Medium0.01827577993873683https://leetcode.com/problems/lru-cache
5706Design HashMap61.3%Easy0.01752893260576219https://leetcode.com/problems/design-hashmap
6557Reverse Words in a String III69.8%Easy0.013731764001315941https://leetcode.com/problems/reverse-words-in-a-string-iii
7295Find Median from Data Stream44.3%Hard0.00899893586856953https://leetcode.com/problems/find-median-from-data-stream
841First Missing Positive32.0%Hard0.0064113058208121855https://leetcode.com/problems/first-missing-positive
956Merge Intervals39.3%Medium0.0034728286335985107https://leetcode.com/problems/merge-intervals
101Two Sum45.6%Easy0.0008206138651873125https://leetcode.com/problems/two-sum