Files
LeetCode-Questions-CompanyWise/cruise-automation_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.1 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2529Minesweeper59.1%Medium0.03486918507635715https://leetcode.com/problems/minesweeper
3146LRU Cache33.2%Medium0.031510805207477295https://leetcode.com/problems/lru-cache
4304Range Sum Query 2D - Immutable38.6%Medium0.023009339909829205https://leetcode.com/problems/range-sum-query-2d-immutable
5695Max Area of Island62.7%Medium0.019939965763769146https://leetcode.com/problems/max-area-of-island
6986Interval List Intersections67.3%Medium0.011438500466121056https://leetcode.com/problems/interval-list-intersections
7200Number of Islands46.8%Medium0.011015601921505717https://leetcode.com/problems/number-of-islands
863Unique Paths II34.6%Medium0.008375258336732413https://leetcode.com/problems/unique-paths-ii
936Valid Sudoku48.7%Medium0.0069420618952821065https://leetcode.com/problems/valid-sudoku
1023Merge k Sorted Lists40.2%Hard0.0038759738446929853https://leetcode.com/problems/merge-k-sorted-lists
1179Word Search35.6%Medium0.0016410260092945288https://leetcode.com/problems/word-search