Files
LeetCode-Questions-CompanyWise/nvidia_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.1 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2939Minimum Area Rectangle51.8%Medium0.03323242792566654https://leetcode.com/problems/minimum-area-rectangle
3231Power of Two43.7%Easy0.021776810232970734https://leetcode.com/problems/power-of-two
4146LRU Cache33.2%Medium0.010321192540274932https://leetcode.com/problems/lru-cache
5206Reverse Linked List62.5%Easy0.009326794511974934https://leetcode.com/problems/reverse-linked-list
6114Flatten Binary Tree to Linked List49.3%Medium0.006896579059060353https://leetcode.com/problems/flatten-binary-tree-to-linked-list
7199Binary Tree Right Side View54.1%Medium0.0056826406650506926https://leetcode.com/problems/binary-tree-right-side-view
822Generate Parentheses62.7%Medium0.0043611059090124735https://leetcode.com/problems/generate-parentheses
923Merge k Sorted Lists40.2%Hard0.004051459000748015https://leetcode.com/problems/merge-k-sorted-lists
101Two Sum45.6%Easy0.003278422738041615https://leetcode.com/problems/two-sum
1133Search in Rotated Sorted Array34.5%Medium0.003229976968332634https://leetcode.com/problems/search-in-rotated-sorted-array