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

2.6 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2223Rectangle Area37.8%Medium0.03472475285136202https://leetcode.com/problems/rectangle-area
3146LRU Cache33.2%Medium0.029400237820807563https://leetcode.com/problems/lru-cache
4231Power of Two43.7%Easy0.027132070647773038https://leetcode.com/problems/power-of-two
5939Minimum Area Rectangle51.8%Medium0.02676703519877789https://leetcode.com/problems/minimum-area-rectangle
6206Reverse Linked List62.5%Easy0.02086427467076072https://leetcode.com/problems/reverse-linked-list
797Interleaving String31.5%Hard0.020471543980187256https://leetcode.com/problems/interleaving-string
833Search in Rotated Sorted Array34.5%Medium0.0200182839715896https://leetcode.com/problems/search-in-rotated-sorted-array
9706Design HashMap61.3%Easy0.01752893260576219https://leetcode.com/problems/design-hashmap
1022Generate Parentheses62.7%Medium0.017331456351639924https://leetcode.com/problems/generate-parentheses
1148Rotate Image56.7%Medium0.011428695823622754https://leetcode.com/problems/rotate-image
12739Daily Temperatures63.3%Medium0.010032690121814417https://leetcode.com/problems/daily-temperatures
13415Add Strings47.5%Easy0.007587289812159497https://leetcode.com/problems/add-strings
141Two Sum45.6%Easy0.0073613942765888805https://leetcode.com/problems/two-sum
15114Flatten Binary Tree to Linked List49.3%Medium0.006896579059060353https://leetcode.com/problems/flatten-binary-tree-to-linked-list
1664Minimum Path Sum54.5%Medium0.006127470152097104https://leetcode.com/problems/minimum-path-sum
17199Binary Tree Right Side View54.1%Medium0.0056826406650506926https://leetcode.com/problems/binary-tree-right-side-view
1842Trapping Rain Water48.9%Hard0.004350670338744988https://leetcode.com/problems/trapping-rain-water
1923Merge k Sorted Lists40.2%Hard0.004051459000748015https://leetcode.com/problems/merge-k-sorted-lists
208String to Integer (atoi)15.4%Medium0.0037925521897059712https://leetcode.com/problems/string-to-integer-atoi
21151Reverse Words in a String21.9%Medium0.003456091915988908https://leetcode.com/problems/reverse-words-in-a-string
22200Number of Islands46.8%Medium0.0028897578265903614https://leetcode.com/problems/number-of-islands
2353Maximum Subarray46.5%Easy0.002167082872150794https://leetcode.com/problems/maximum-subarray
242Add Two Numbers33.9%Medium0.0016886191111440908https://leetcode.com/problems/add-two-numbers
2570Climbing Stairs47.8%Easy0.0015084665529624085https://leetcode.com/problems/climbing-stairs