Files
LeetCode-Questions-CompanyWise/wayfair_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
2840Magic Squares In Grid37.3%Easy0.4449565940664958https://leetcode.com/problems/magic-squares-in-grid
3811Subdomain Visit Count69.9%Easy0.28185115214098777https://leetcode.com/problems/subdomain-visit-count
41189Maximum Number of Balloons61.2%Easy0.11874571021547974https://leetcode.com/problems/maximum-number-of-balloons
5759Employee Free Time66.3%Hard0.10143824284548837https://leetcode.com/problems/employee-free-time
61204Last Person to Fit in the Elevator69.8%Medium0.08515780834030685https://leetcode.com/problems/last-person-to-fit-in-the-elevator
71212Team Scores in Football Tournament55.8%Medium0.07862594238342736https://leetcode.com/problems/team-scores-in-football-tournament
885Maximal Rectangle37.7%Hard0.028510008258377777https://leetcode.com/problems/maximal-rectangle
9718Maximum Length of Repeated Subarray49.4%Medium0.02699219201435624https://leetcode.com/problems/maximum-length-of-repeated-subarray
1056Merge Intervals39.3%Medium0.0074386655924217485https://leetcode.com/problems/merge-intervals
11412Fizz Buzz62.3%Easy0.006857561589870336https://leetcode.com/problems/fizz-buzz
1269Sqrt(x)33.9%Easy0.004881034705914313https://leetcode.com/problems/sqrtx
13125Valid Palindrome36.7%Easy0.0037979536727587773https://leetcode.com/problems/valid-palindrome
145Longest Palindromic Substring29.5%Medium0.0021771085723255794https://leetcode.com/problems/longest-palindromic-substring
15210Course Schedule II40.7%Medium0.0018850146957713153https://leetcode.com/problems/course-schedule-ii