LeetCode-Questions-CompanyWise/wayfair_alltime.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.5 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
21212Team Scores in Football Tournament55.8%Medium1.1574169741354225https://leetcode.com/problems/team-scores-in-football-tournament
3840Magic Squares In Grid37.3%Easy0.7861804130990654https://leetcode.com/problems/magic-squares-in-grid
41194Tournament Winners52.9%Hard0.4149438520627081https://leetcode.com/problems/tournament-winners
5811Subdomain Visit Count69.9%Easy0.35434665417914124https://leetcode.com/problems/subdomain-visit-count
61204Last Person to Fit in the Elevator69.8%Medium0.3042113744029915https://leetcode.com/problems/last-person-to-fit-in-the-elevator
71189Maximum Number of Balloons61.2%Easy0.11874571021547974https://leetcode.com/problems/maximum-number-of-balloons
8759Employee Free Time66.3%Hard0.10143824284548837https://leetcode.com/problems/employee-free-time
91014Best Sightseeing Pair52.5%Medium0.0903548750399561https://leetcode.com/problems/best-sightseeing-pair
10443String Compression41.3%Easy0.052333720049023605https://leetcode.com/problems/string-compression
1185Maximal Rectangle37.7%Hard0.050135812424355455https://leetcode.com/problems/maximal-rectangle
125Longest Palindromic Substring29.5%Medium0.034277441353764176https://leetcode.com/problems/longest-palindromic-substring
13412Fizz Buzz62.3%Easy0.027152525030955416https://leetcode.com/problems/fizz-buzz
14718Maximum Length of Repeated Subarray49.4%Medium0.02699219201435624https://leetcode.com/problems/maximum-length-of-repeated-subarray
15125Valid Palindrome36.7%Easy0.023503949324973204https://leetcode.com/problems/valid-palindrome
16184Department Highest Salary36.7%Medium0.018018505502678313https://leetcode.com/problems/department-highest-salary
1756Merge Intervals39.3%Medium0.013186279740090647https://leetcode.com/problems/merge-intervals
1869Sqrt(x)33.9%Easy0.010949014489670414https://leetcode.com/problems/sqrtx
1953Maximum Subarray46.5%Easy0.008272628741228982https://leetcode.com/problems/maximum-subarray
2041First Missing Positive32.0%Hard0.006163347707668678https://leetcode.com/problems/first-missing-positive
21210Course Schedule II40.7%Medium0.0018850146957713153https://leetcode.com/problems/course-schedule-ii
221244Design A Leaderboard60.7%Medium0https://leetcode.com/problems/design-a-leaderboard
231405Longest Happy String49.0%Medium0https://leetcode.com/problems/longest-happy-string
241193Monthly Transactions I68.3%Medium0https://leetcode.com/problems/monthly-transactions-i