LeetCode-Questions-CompanyWise/dropbox_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
2609Find Duplicate File in System59.5%Medium4.308646054568235https://leetcode.com/problems/find-duplicate-file-in-system
3924Minimize Malware Spread42.0%Hard3.7034072588050604https://leetcode.com/problems/minimize-malware-spread
4289Game of Life54.5%Medium3.452499696999781https://leetcode.com/problems/game-of-life
5379Design Phone Directory46.8%Medium2.546315277916644https://leetcode.com/problems/design-phone-directory
6928Minimize Malware Spread II40.5%Hard1.6401308588335066https://leetcode.com/problems/minimize-malware-spread-ii
71242Web Crawler Multithreaded45.9%Medium0.8967461358011848https://leetcode.com/problems/web-crawler-multithreaded
81178Number of Valid Words for Each Puzzle37.8%Hard0.8109302162163288https://leetcode.com/problems/number-of-valid-words-for-each-puzzle
9642Design Search Autocomplete System44.7%Hard0.43349242036282026https://leetcode.com/problems/design-search-autocomplete-system
10146LRU Cache33.2%Medium0.13057313078965735https://leetcode.com/problems/lru-cache
111010Pairs of Songs With Total Durations Divisible by 6047.4%Easy0.09171392769013605https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
12362Design Hit Counter63.7%Medium0.05622967649867821https://leetcode.com/problems/design-hit-counter
1317Letter Combinations of a Phone Number46.8%Medium0.017492519932499718https://leetcode.com/problems/letter-combinations-of-a-phone-number
1464Minimum Path Sum54.5%Medium0.013734383449598314https://leetcode.com/problems/minimum-path-sum
1528Implement strStr()34.5%Easy0.003943222775040032https://leetcode.com/problems/implement-strstr