LeetCode-Questions-CompanyWise/visa_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
2761Special Binary String54.7%Hard0.09348775380846833https://leetcode.com/problems/special-binary-string
3362Design Hit Counter63.7%Medium0.05622967649867821https://leetcode.com/problems/design-hit-counter
41353Maximum Number of Events That Can Be Attended30.5%Medium0.05428741283782842https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended
542Trapping Rain Water48.9%Hard0.05203424501747888https://leetcode.com/problems/trapping-rain-water
654Spiral Matrix34.1%Medium0.014776167707688753https://leetcode.com/problems/spiral-matrix
776Minimum Window Substring34.6%Hard0.013966707481708198https://leetcode.com/problems/minimum-window-substring
8380Insert Delete GetRandom O(1)47.5%Medium0.009820849864094454https://leetcode.com/problems/insert-delete-getrandom-o1
9253Meeting Rooms II45.7%Medium0.008079219870546493https://leetcode.com/problems/meeting-rooms-ii
1098Validate Binary Search Tree27.8%Medium0.006611351489350257https://leetcode.com/problems/validate-binary-search-tree
11153Sum26.8%Medium0.004940992758742591https://leetcode.com/problems/3sum
12121Best Time to Buy and Sell Stock50.5%Easy0.0047725193990346675https://leetcode.com/problems/best-time-to-buy-and-sell-stock
131Two Sum45.6%Easy0.003278422738041615https://leetcode.com/problems/two-sum
14206Reverse Linked List62.5%Easy0.0023398665252948926https://leetcode.com/problems/reverse-linked-list
1520Valid Parentheses39.0%Easy0.0023005704055949323https://leetcode.com/problems/valid-parentheses