Files
LeetCode-Questions-CompanyWise/cruise-automation_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
21258Synonymous Sentences64.4%Medium0.6677654778785802https://leetcode.com/problems/synonymous-sentences
3146LRU Cache33.2%Medium0.6161320189263424https://leetcode.com/problems/lru-cache
4529Minesweeper59.1%Medium0.42248679567759495https://leetcode.com/problems/minesweeper
5281Zigzag Iterator58.4%Medium0.22884157242884745https://leetcode.com/problems/zigzag-iterator
6200Number of Islands46.8%Medium0.20236848873924537https://leetcode.com/problems/number-of-islands
7304Range Sum Query 2D - Immutable38.6%Medium0.053010091368830885https://leetcode.com/problems/range-sum-query-2d-immutable
856Merge Intervals39.3%Medium0.051732885823426https://leetcode.com/problems/merge-intervals
9394Decode String50.0%Medium0.030783500343535258https://leetcode.com/problems/decode-string
1044Wildcard Matching24.7%Hard0.029260865212976276https://leetcode.com/problems/wildcard-matching
11695Max Area of Island62.7%Medium0.02709377046225989https://leetcode.com/problems/max-area-of-island
12986Interval List Intersections67.3%Medium0.025555053351030123https://leetcode.com/problems/interval-list-intersections
1323Merge k Sorted Lists40.2%Hard0.023981964686485415https://leetcode.com/problems/merge-k-sorted-lists
1479Word Search35.6%Medium0.014673179500416637https://leetcode.com/problems/word-search
1563Unique Paths II34.6%Medium0.008375258336732413https://leetcode.com/problems/unique-paths-ii
1636Valid Sudoku48.7%Medium0.0069420618952821065https://leetcode.com/problems/valid-sudoku