Files
LeetCode-Questions-CompanyWise/baidu_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.8 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2871Minimum Number of Refueling Stops31.4%Hard0.021853241177366825https://leetcode.com/problems/minimum-number-of-refueling-stops
3146LRU Cache33.2%Medium0.017369086240613615https://leetcode.com/problems/lru-cache
491Decode Ways24.7%Medium0.012884931303860403https://leetcode.com/problems/decode-ways
572Edit Distance44.8%Hard0.009571740941281605https://leetcode.com/problems/edit-distance
6113Path Sum II46.7%Medium0.009374336284705936https://leetcode.com/problems/path-sum-ii
7215Kth Largest Element in an Array55.4%Medium0.00838696557248326https://leetcode.com/problems/kth-largest-element-in-an-array
8240Search a 2D Matrix II43.2%Medium0.007279377002901276https://leetcode.com/problems/search-a-2d-matrix-ii
933Search in Rotated Sorted Array34.5%Medium0.006961661779487692https://leetcode.com/problems/search-in-rotated-sorted-array
1088Merge Sorted Array39.4%Easy0.006480904084083141https://leetcode.com/problems/merge-sorted-array
112Add Two Numbers33.9%Medium0.006462841091831753https://leetcode.com/problems/add-two-numbers
12124Binary Tree Maximum Path Sum34.3%Hard0.005272883295230408https://leetcode.com/problems/binary-tree-maximum-path-sum
13543Diameter of Binary Tree48.4%Easy0.005047966297304777https://leetcode.com/problems/diameter-of-binary-tree
141Two Sum45.6%Easy0.004901297870354067https://leetcode.com/problems/two-sum
15153Sum26.8%Medium0.002081166203824567https://leetcode.com/problems/3sum
163Longest Substring Without Repeating Characters30.4%Medium0.0014852223137141987https://leetcode.com/problems/longest-substring-without-repeating-characters
1770Climbing Stairs47.8%Easy0.0014753073158671238https://leetcode.com/problems/climbing-stairs