Files
LeetCode-Questions-CompanyWise/audible_2year.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
21228Missing Number In Arithmetic Progression52.6%Easy0.14893621100754167https://leetcode.com/problems/missing-number-in-arithmetic-progression
3545Boundary of Binary Tree38.9%Medium0.0877756108823857https://leetcode.com/problems/boundary-of-binary-tree
4472Concatenated Words43.7%Hard0.026615010757229714https://leetcode.com/problems/concatenated-words
5140Word Break II32.6%Hard0.01660836687673306https://leetcode.com/problems/word-break-ii
673Set Matrix Zeroes43.1%Medium0.015010288493889185https://leetcode.com/problems/set-matrix-zeroes
7200Number of Islands46.8%Medium0.011015601921505717https://leetcode.com/problems/number-of-islands
8139Word Break40.1%Medium0.008429383994401785https://leetcode.com/problems/word-break
9937Reorder Data in Log Files54.3%Easy0.00802733590076424https://leetcode.com/problems/reorder-data-in-log-files
10127Word Ladder29.6%Medium0.005731495844689608https://leetcode.com/problems/word-ladder
1142Trapping Rain Water48.9%Hard0.00411947029523883https://leetcode.com/problems/trapping-rain-water
1223Merge k Sorted Lists40.2%Hard0.0038759738446929853https://leetcode.com/problems/merge-k-sorted-lists
13101Symmetric Tree46.8%Easy0.0032666423495169026https://leetcode.com/problems/symmetric-tree
1420Valid Parentheses39.0%Easy0.002197682330605871https://leetcode.com/problems/valid-parentheses
15121Best Time to Buy and Sell Stock50.5%Easy0.0020383211296970956https://leetcode.com/problems/best-time-to-buy-and-sell-stock
161Two Sum45.6%Easy0.001767235914611495https://leetcode.com/problems/two-sum