LeetCode-Questions-CompanyWise/tableau_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
2238Product of Array Except Self60.1%Medium0.1924592954490137https://leetcode.com/problems/product-of-array-except-self
3273Integer to English Words27.1%Hard0.1453851138462884https://leetcode.com/problems/integer-to-english-words
451N-Queens46.6%Hard0.09831093224356313https://leetcode.com/problems/n-queens
5218The Skyline Problem34.6%Hard0.09823843958341322https://leetcode.com/problems/the-skyline-problem
6706Design HashMap61.3%Easy0.0683442674369718https://leetcode.com/problems/design-hashmap
7297Serialize and Deserialize Binary Tree47.5%Hard0.061960627359177074https://leetcode.com/problems/serialize-and-deserialize-binary-tree
8227Basic Calculator II36.9%Medium0.027685557859864054https://leetcode.com/problems/basic-calculator-ii
9200Number of Islands46.8%Medium0.025712029212602353https://leetcode.com/problems/number-of-islands
10121Best Time to Buy and Sell Stock50.5%Easy0.018954919107260947https://leetcode.com/problems/best-time-to-buy-and-sell-stock
1123Merge k Sorted Lists40.2%Hard0.016108271385328228https://leetcode.com/problems/merge-k-sorted-lists
1257Insert Interval33.5%Hard0.013119243592498872https://leetcode.com/problems/insert-interval
131Two Sum45.6%Easy0.013049691753224608https://leetcode.com/problems/two-sum
1442Trapping Rain Water48.9%Hard0.004350670338744988https://leetcode.com/problems/trapping-rain-water
1588Merge Sorted Array39.4%Easy0.0030102370714243072https://leetcode.com/problems/merge-sorted-array