LeetCode-Questions-CompanyWise/cohesity_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.4 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
225Reverse Nodes in k-Group42.1%Hard0.05055437541222425https://leetcode.com/problems/reverse-nodes-in-k-group
376Minimum Window Substring34.6%Hard0.04336436867416216https://leetcode.com/problems/minimum-window-substring
4845Longest Mountain in Array37.2%Medium0.03578987502740307https://leetcode.com/problems/longest-mountain-in-array
5269Alien Dictionary33.3%Hard0.027110094009475887https://leetcode.com/problems/alien-dictionary
6166Fraction to Recurring Decimal21.6%Medium0.019305618894153366https://leetcode.com/problems/fraction-to-recurring-decimal
7207Course Schedule43.1%Medium0.010625837876226181https://leetcode.com/problems/course-schedule
823Merge k Sorted Lists40.2%Hard0.008699909875545938https://leetcode.com/problems/merge-k-sorted-lists
9127Word Ladder29.6%Medium0.005731495844689608https://leetcode.com/problems/word-ladder
1056Merge Intervals39.3%Medium0.0033129067901687907https://leetcode.com/problems/merge-intervals
11200Number of Islands46.8%Medium0.002765297303115152https://leetcode.com/problems/number-of-islands
12283Move Zeroes57.8%Easy0.002758622439079723https://leetcode.com/problems/move-zeroes
1326Remove Duplicates from Sorted Array45.1%Easy0.0018681118827202508https://leetcode.com/problems/remove-duplicates-from-sorted-array