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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2984String Without AAA or BBB37.7%Medium0.4954247677613364https://leetcode.com/problems/string-without-aaa-or-bbb
3915Partition Array into Disjoint Intervals45.4%Medium0.37292635232139065https://leetcode.com/problems/partition-array-into-disjoint-intervals
4983Minimum Cost For Tickets60.5%Medium0.26701398643191887https://leetcode.com/problems/minimum-cost-for-tickets
5527Word Abbreviation54.3%Hard0.24362208265775043https://leetcode.com/problems/word-abbreviation
61017Convert to Base -259.0%Medium0.17904823144898546https://leetcode.com/problems/convert-to-base-2
71253Reconstruct a 2-Row Binary Matrix40.4%Medium0.16098937604759944https://leetcode.com/problems/reconstruct-a-2-row-binary-matrix
842Trapping Rain Water48.9%Hard0.038490960607653675https://leetcode.com/problems/trapping-rain-water
92Add Two Numbers33.9%Medium0.020491663368639005https://leetcode.com/problems/add-two-numbers
1041First Missing Positive32.0%Hard0.014368063266920193https://leetcode.com/problems/first-missing-positive
11121Best Time to Buy and Sell Stock50.5%Easy0.00846879565300311https://leetcode.com/problems/best-time-to-buy-and-sell-stock
12234Palindrome Linked List39.3%Easy0.004533613114828982https://leetcode.com/problems/palindrome-linked-list
13238Product of Array Except Self60.1%Medium0.003930436424724545https://leetcode.com/problems/product-of-array-except-self
14215Kth Largest Element in an Array55.4%Medium0.003902443976931749https://leetcode.com/problems/kth-largest-element-in-an-array
151073Adding Two Negabinary Numbers34.2%Medium0https://leetcode.com/problems/adding-two-negabinary-numbers