Files
LeetCode-Questions-CompanyWise/yahoo_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.3 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2669Trim a Binary Search Tree63.0%Easy0.015052444911090134https://leetcode.com/problems/trim-a-binary-search-tree
3384Shuffle an Array52.8%Medium0.011375721700252122https://leetcode.com/problems/shuffle-an-array
477Combinations54.7%Medium0.008578021081192079https://leetcode.com/problems/combinations
51Two Sum45.6%Easy0.004901297870354067https://leetcode.com/problems/two-sum
6207Course Schedule43.1%Medium0.004736539346673217https://leetcode.com/problems/course-schedule
742Trapping Rain Water48.9%Hard0.00411947029523883https://leetcode.com/problems/trapping-rain-water
813Roman to Integer55.7%Easy0.0032749333347487667https://leetcode.com/problems/roman-to-integer
9200Number of Islands46.8%Medium0.002765297303115152https://leetcode.com/problems/number-of-islands
10260Single Number III64.3%Medium0.002022143148991901https://leetcode.com/problems/single-number-iii
117Reverse Integer25.8%Easy0.0017826905514433007https://leetcode.com/problems/reverse-integer
122Add Two Numbers33.9%Medium0.0016196302686159038https://leetcode.com/problems/add-two-numbers
133Longest Substring Without Repeating Characters30.4%Medium0.0014852223137141987https://leetcode.com/problems/longest-substring-without-repeating-characters