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)

```
This commit is contained in:
Krishna Kumar Dey
2023-04-01 11:07:49 +05:30
committed by GitHub
parent 0aeadbd612
commit fb5f78b55e
534 changed files with 20291 additions and 19757 deletions

View File

@@ -1,8 +1,9 @@
609,Find Duplicate File in System,59.5%,Medium,2.404143967080495, https://leetcode.com/problems/find-duplicate-file-in-system
289,Game of Life,54.5%,Medium,1.699930916292986, https://leetcode.com/problems/game-of-life
379,Design Phone Directory,46.8%,Medium,0.9957178655054769, https://leetcode.com/problems/design-phone-directory
1242,Web Crawler Multithreaded,45.9%,Medium,0.8967461358011848, https://leetcode.com/problems/web-crawler-multithreaded
1178,Number of Valid Words for Each Puzzle,37.8%,Hard,0.8109302162163288, https://leetcode.com/problems/number-of-valid-words-for-each-puzzle
642,Design Search Autocomplete System,44.7%,Hard,0.43349242036282026, https://leetcode.com/problems/design-search-autocomplete-system
146,LRU Cache,33.2%,Medium,0.1090999130829226, https://leetcode.com/problems/lru-cache
362,Design Hit Counter,63.7%,Medium,0.025382073271417165, https://leetcode.com/problems/design-hit-counter
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
609,Find Duplicate File in System,59.5%,Medium,2.404143967080495, https://leetcode.com/problems/find-duplicate-file-in-system
289,Game of Life,54.5%,Medium,1.699930916292986, https://leetcode.com/problems/game-of-life
379,Design Phone Directory,46.8%,Medium,0.9957178655054769, https://leetcode.com/problems/design-phone-directory
1242,Web Crawler Multithreaded,45.9%,Medium,0.8967461358011848, https://leetcode.com/problems/web-crawler-multithreaded
1178,Number of Valid Words for Each Puzzle,37.8%,Hard,0.8109302162163288, https://leetcode.com/problems/number-of-valid-words-for-each-puzzle
642,Design Search Autocomplete System,44.7%,Hard,0.43349242036282026, https://leetcode.com/problems/design-search-autocomplete-system
146,LRU Cache,33.2%,Medium,0.1090999130829226, https://leetcode.com/problems/lru-cache
362,Design Hit Counter,63.7%,Medium,0.025382073271417165, https://leetcode.com/problems/design-hit-counter
1 609 ID Find Duplicate File in System Title 59.5% Acceptance Medium Difficulty 2.404143967080495 Frequency https://leetcode.com/problems/find-duplicate-file-in-system Leetcode Question Link
2 289 609 Game of Life Find Duplicate File in System 54.5% 59.5% Medium Medium 1.699930916292986 2.404143967080495 https://leetcode.com/problems/game-of-life https://leetcode.com/problems/find-duplicate-file-in-system
3 379 289 Design Phone Directory Game of Life 46.8% 54.5% Medium Medium 0.9957178655054769 1.699930916292986 https://leetcode.com/problems/design-phone-directory https://leetcode.com/problems/game-of-life
4 1242 379 Web Crawler Multithreaded Design Phone Directory 45.9% 46.8% Medium Medium 0.8967461358011848 0.9957178655054769 https://leetcode.com/problems/web-crawler-multithreaded https://leetcode.com/problems/design-phone-directory
5 1178 1242 Number of Valid Words for Each Puzzle Web Crawler Multithreaded 37.8% 45.9% Hard Medium 0.8109302162163288 0.8967461358011848 https://leetcode.com/problems/number-of-valid-words-for-each-puzzle https://leetcode.com/problems/web-crawler-multithreaded
6 642 1178 Design Search Autocomplete System Number of Valid Words for Each Puzzle 44.7% 37.8% Hard Hard 0.43349242036282026 0.8109302162163288 https://leetcode.com/problems/design-search-autocomplete-system https://leetcode.com/problems/number-of-valid-words-for-each-puzzle
7 146 642 LRU Cache Design Search Autocomplete System 33.2% 44.7% Medium Hard 0.1090999130829226 0.43349242036282026 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/design-search-autocomplete-system
8 362 146 Design Hit Counter LRU Cache 63.7% 33.2% Medium Medium 0.025382073271417165 0.1090999130829226 https://leetcode.com/problems/design-hit-counter https://leetcode.com/problems/lru-cache
9 362 Design Hit Counter 63.7% Medium 0.025382073271417165 https://leetcode.com/problems/design-hit-counter