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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2724Find Pivot Index44.0%Easy0.02210881658703743https://leetcode.com/problems/find-pivot-index
3146LRU Cache33.2%Medium0.01827577993873683https://leetcode.com/problems/lru-cache
4253Meeting Rooms II45.7%Medium0.018087309810579388https://leetcode.com/problems/meeting-rooms-ii
520Valid Parentheses39.0%Easy0.014292491180025941https://leetcode.com/problems/valid-parentheses
61Two Sum45.6%Easy0.013049691753224608https://leetcode.com/problems/two-sum
7279Perfect Squares47.4%Medium0.009216655104924008https://leetcode.com/problems/perfect-squares
863Unique Paths II34.6%Medium0.008712753874961187https://leetcode.com/problems/unique-paths-ii
9344Reverse String68.5%Easy0.00734157796234515https://leetcode.com/problems/reverse-string
1076Minimum Window Substring34.6%Hard0.006231520398723243https://leetcode.com/problems/minimum-window-substring
115Longest Palindromic Substring29.5%Medium0.005121212968082452https://leetcode.com/problems/longest-palindromic-substring
12441Arranging Coins41.9%Easy0.004995639214187909https://leetcode.com/problems/arranging-coins
1346Permutations63.5%Medium0.004216302230139218https://leetcode.com/problems/permutations
144Median of Two Sorted Arrays29.6%Hard0.003900160950094767https://leetcode.com/problems/median-of-two-sorted-arrays
15139Word Break40.1%Medium0.003894465052690167https://leetcode.com/problems/word-break
1656Merge Intervals39.3%Medium0.0034728286335985107https://leetcode.com/problems/merge-intervals
17200Number of Islands46.8%Medium0.0028897578265903614https://leetcode.com/problems/number-of-islands