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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2146LRU Cache33.2%Medium0.16703842296841676https://leetcode.com/problems/lru-cache
3281Zigzag Iterator58.4%Medium0.10821358464023274https://leetcode.com/problems/zigzag-iterator
4529Minesweeper59.1%Medium0.09218395607805856https://leetcode.com/problems/minesweeper
5200Number of Islands46.8%Medium0.033359117749874545https://leetcode.com/problems/number-of-islands
6304Range Sum Query 2D - Immutable38.6%Medium0.03016314460831995https://leetcode.com/problems/range-sum-query-2d-immutable
7695Max Area of Island62.7%Medium0.02709377046225989https://leetcode.com/problems/max-area-of-island
844Wildcard Matching24.7%Hard0.013110643383019215https://leetcode.com/problems/wildcard-matching
9986Interval List Intersections67.3%Medium0.011438500466121056https://leetcode.com/problems/interval-list-intersections
1023Merge k Sorted Lists40.2%Hard0.008699909875545938https://leetcode.com/problems/merge-k-sorted-lists
1163Unique Paths II34.6%Medium0.008375258336732413https://leetcode.com/problems/unique-paths-ii
12394Decode String50.0%Medium0.0077851697215559675https://leetcode.com/problems/decode-string
1356Merge Intervals39.3%Medium0.0074386655924217485https://leetcode.com/problems/merge-intervals
1436Valid Sudoku48.7%Medium0.0069420618952821065https://leetcode.com/problems/valid-sudoku
1579Word Search35.6%Medium0.006548007844690591https://leetcode.com/problems/word-search