Files
LeetCode-Questions-CompanyWise/godaddy_alltime.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
2441Arranging Coins41.9%Easy0.08973851726005694https://leetcode.com/problems/arranging-coins
3146LRU Cache33.2%Medium0.07118067822062889https://leetcode.com/problems/lru-cache
420Valid Parentheses39.0%Easy0.055983722381420686https://leetcode.com/problems/valid-parentheses
51Two Sum45.6%Easy0.051207090852741735https://leetcode.com/problems/two-sum
6253Meeting Rooms II45.7%Medium0.04945628059066218https://leetcode.com/problems/meeting-rooms-ii
7724Find Pivot Index44.0%Easy0.03089844155123413https://leetcode.com/problems/find-pivot-index
863Unique Paths II34.6%Medium0.01949801804099658https://leetcode.com/problems/unique-paths-ii
9139Word Break40.1%Medium0.015487677691351377https://leetcode.com/problems/word-break
105Longest Palindromic Substring29.5%Medium0.01416133329402493https://leetcode.com/problems/longest-palindromic-substring
1156Merge Intervals39.3%Medium0.013819532422258866https://leetcode.com/problems/merge-intervals
12344Reverse String68.5%Easy0.013014662307854044https://leetcode.com/problems/reverse-string
13200Number of Islands46.8%Medium0.011509262420590827https://leetcode.com/problems/number-of-islands
14279Perfect Squares47.4%Medium0.009216655104924008https://leetcode.com/problems/perfect-squares
1576Minimum Window Substring34.6%Hard0.006231520398723243https://leetcode.com/problems/minimum-window-substring
1646Permutations63.5%Medium0.004216302230139218https://leetcode.com/problems/permutations
174Median of Two Sorted Arrays29.6%Hard0.003900160950094767https://leetcode.com/problems/median-of-two-sorted-arrays
18443String Compression41.3%Easy0https://leetcode.com/problems/string-compression