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

2.0 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
8443String Compression41.3%Easy0.052333720049023605https://leetcode.com/problems/string-compression
985Maximal Rectangle37.7%Hard0.050135812424355455https://leetcode.com/problems/maximal-rectangle
10412Fizz Buzz62.3%Easy0.027152525030955416https://leetcode.com/problems/fizz-buzz
11718Maximum Length of Repeated Subarray49.4%Medium0.02699219201435624https://leetcode.com/problems/maximum-length-of-repeated-subarray
125Longest Palindromic Substring29.5%Medium0.019425420619316486https://leetcode.com/problems/longest-palindromic-substring
13184Department Highest Salary36.7%Medium0.018018505502678313https://leetcode.com/problems/department-highest-salary
14125Valid Palindrome36.7%Easy0.015106027431013205https://leetcode.com/problems/valid-palindrome
1569Sqrt(x)33.9%Easy0.010949014489670414https://leetcode.com/problems/sqrtx
1656Merge Intervals39.3%Medium0.0074386655924217485https://leetcode.com/problems/merge-intervals
1741First Missing Positive32.0%Hard0.006163347707668678https://leetcode.com/problems/first-missing-positive
1853Maximum Subarray46.5%Easy0.0020745819379855658https://leetcode.com/problems/maximum-subarray
19210Course Schedule II40.7%Medium0.0018850146957713153https://leetcode.com/problems/course-schedule-ii