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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2736Parse Lisp Expression47.5%Hard0.7290367865107017https://leetcode.com/problems/parse-lisp-expression
3381Insert Delete GetRandom O(1) - Duplicates allowed34.1%Hard0.49586980740929654https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
4695Max Area of Island62.7%Medium0.31425595727716876https://leetcode.com/problems/max-area-of-island
5380Insert Delete GetRandom O(1)47.5%Medium0.08108897817576358https://leetcode.com/problems/insert-delete-getrandom-o1
649Group Anagrams56.9%Medium0.05662724563684648https://leetcode.com/problems/group-anagrams
7200Number of Islands46.8%Medium0.033359117749874545https://leetcode.com/problems/number-of-islands
8362Design Hit Counter63.7%Medium0.024317307650706343https://leetcode.com/problems/design-hit-counter
9322Coin Change35.5%Medium0.008671409957551127https://leetcode.com/problems/coin-change
10230Kth Smallest Element in a BST60.2%Medium0.006085520073802784https://leetcode.com/problems/kth-smallest-element-in-a-bst
11127Word Ladder29.6%Medium0.005731495844689608https://leetcode.com/problems/word-ladder
1242Trapping Rain Water48.9%Hard0.00411947029523883https://leetcode.com/problems/trapping-rain-water
131Two Sum45.6%Easy0.003139596786381058https://leetcode.com/problems/two-sum