LeetCode-Questions-CompanyWise/ixl_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.0 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2166Fraction to Recurring Decimal21.6%Medium0.3214580219607569https://leetcode.com/problems/fraction-to-recurring-decimal
3945Minimum Increment to Make Array Unique46.3%Medium0.24996776739863846https://leetcode.com/problems/minimum-increment-to-make-array-unique
4691Stickers to Spell Word42.9%Hard0.2131528906392817https://leetcode.com/problems/stickers-to-spell-word
5592Fraction Addition and Subtraction49.0%Medium0.1394125430225106https://leetcode.com/problems/fraction-addition-and-subtraction
6598Range Addition II49.6%Easy0.0863907376989368https://leetcode.com/problems/range-addition-ii
714Longest Common Prefix35.4%Easy0.012650390082165711https://leetcode.com/problems/longest-common-prefix
8234Palindrome Linked List39.3%Easy0.009716151141728767https://leetcode.com/problems/palindrome-linked-list
923Merge k Sorted Lists40.2%Hard0.008699909875545938https://leetcode.com/problems/merge-k-sorted-lists