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

1.6 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2828Count Unique Characters of All Substrings of a Given String45.2%Hard0.4064583363781751https://leetcode.com/problems/count-unique-characters-of-all-substrings-of-a-given-string
3695Max Area of Island62.7%Medium0.2770125235595406https://leetcode.com/problems/max-area-of-island
4723Candy Crush69.2%Medium0.1475667107409061https://leetcode.com/problems/candy-crush
5200Number of Islands46.8%Medium0.06985103785996453https://leetcode.com/problems/number-of-islands
656Merge Intervals39.3%Medium0.030829638084076787https://leetcode.com/problems/merge-intervals
7977Squares of a Sorted Array72.1%Easy0.015474196582597383https://leetcode.com/problems/squares-of-a-sorted-array
841First Missing Positive32.0%Hard0.014368063266920193https://leetcode.com/problems/first-missing-positive
9767Reorganize String48.7%Medium0.01329806830463147https://leetcode.com/problems/reorganize-string
10146LRU Cache33.2%Medium0.010321192540274932https://leetcode.com/problems/lru-cache
113Longest Substring Without Repeating Characters30.4%Medium0.009683242444739549https://leetcode.com/problems/longest-substring-without-repeating-characters
1233Search in Rotated Sorted Array34.5%Medium0.007252832180390353https://leetcode.com/problems/search-in-rotated-sorted-array
131230Toss Strange Coins48.7%Medium0https://leetcode.com/problems/toss-strange-coins
141435Create a Session Bar Chart76.9%Easy0https://leetcode.com/problems/create-a-session-bar-chart
151500Design a File Sharing System45.8%Medium0https://leetcode.com/problems/design-a-file-sharing-system