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,22 +1,23 @@
609,Find Duplicate File in System,59.5%,Medium,5.67594859888821, https://leetcode.com/problems/find-duplicate-file-in-system
289,Game of Life,54.5%,Medium,4.950737575757486, https://leetcode.com/problems/game-of-life
924,Minimize Malware Spread,42.0%,Hard,4.0636699251252715, https://leetcode.com/problems/minimize-malware-spread
379,Design Phone Directory,46.8%,Medium,3.4802548518846486, https://leetcode.com/problems/design-phone-directory
291,Word Pattern II,43.4%,Hard,3.080206637191811, https://leetcode.com/problems/word-pattern-ii
362,Design Hit Counter,63.7%,Medium,2.7212063428291313, https://leetcode.com/problems/design-hit-counter
928,Minimize Malware Spread II,40.5%,Hard,1.8341386921969165, https://leetcode.com/problems/minimize-malware-spread-ii
1242,Web Crawler Multithreaded,45.9%,Medium,1.7713921664036212, https://leetcode.com/problems/web-crawler-multithreaded
1178,Number of Valid Words for Each Puzzle,37.8%,Hard,1.0828639316999706, https://leetcode.com/problems/number-of-valid-words-for-each-puzzle
1001,Grid Illumination,35.9%,Hard,1.0479685558493548, https://leetcode.com/problems/grid-illumination
642,Design Search Autocomplete System,44.7%,Hard,0.9534648850908103, https://leetcode.com/problems/design-search-autocomplete-system
17,Letter Combinations of a Phone Number,46.8%,Medium,0.8219594485525382, https://leetcode.com/problems/letter-combinations-of-a-phone-number
290,Word Pattern,37.0%,Easy,0.3813449098066498, https://leetcode.com/problems/word-pattern
1236,Web Crawler,64.3%,Medium,0.33647223662121295, https://leetcode.com/problems/web-crawler
146,LRU Cache,33.2%,Medium,0.31735278471778255, https://leetcode.com/problems/lru-cache
1010,Pairs of Songs With Total Durations Divisible by 60,47.4%,Easy,0.09171392769013605, https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
140,Word Break II,32.6%,Hard,0.07881168148917794, https://leetcode.com/problems/word-break-ii
1,Two Sum,45.6%,Easy,0.016487580637467636, https://leetcode.com/problems/two-sum
4,Median of Two Sorted Arrays,29.6%,Hard,0.015510198481701449, https://leetcode.com/problems/median-of-two-sorted-arrays
64,Minimum Path Sum,54.5%,Medium,0.013734383449598314, https://leetcode.com/problems/minimum-path-sum
28,Implement strStr(),34.5%,Easy,0.008850485542574548, https://leetcode.com/problems/implement-strstr
1250,Check If It Is a Good Array,55.7%,Hard,0, https://leetcode.com/problems/check-if-it-is-a-good-array
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
609,Find Duplicate File in System,59.5%,Medium,5.67594859888821, https://leetcode.com/problems/find-duplicate-file-in-system
289,Game of Life,54.5%,Medium,4.950737575757486, https://leetcode.com/problems/game-of-life
924,Minimize Malware Spread,42.0%,Hard,4.0636699251252715, https://leetcode.com/problems/minimize-malware-spread
379,Design Phone Directory,46.8%,Medium,3.4802548518846486, https://leetcode.com/problems/design-phone-directory
291,Word Pattern II,43.4%,Hard,3.080206637191811, https://leetcode.com/problems/word-pattern-ii
362,Design Hit Counter,63.7%,Medium,2.7212063428291313, https://leetcode.com/problems/design-hit-counter
928,Minimize Malware Spread II,40.5%,Hard,1.8341386921969165, https://leetcode.com/problems/minimize-malware-spread-ii
1242,Web Crawler Multithreaded,45.9%,Medium,1.7713921664036212, https://leetcode.com/problems/web-crawler-multithreaded
1178,Number of Valid Words for Each Puzzle,37.8%,Hard,1.0828639316999706, https://leetcode.com/problems/number-of-valid-words-for-each-puzzle
1001,Grid Illumination,35.9%,Hard,1.0479685558493548, https://leetcode.com/problems/grid-illumination
642,Design Search Autocomplete System,44.7%,Hard,0.9534648850908103, https://leetcode.com/problems/design-search-autocomplete-system
17,Letter Combinations of a Phone Number,46.8%,Medium,0.8219594485525382, https://leetcode.com/problems/letter-combinations-of-a-phone-number
290,Word Pattern,37.0%,Easy,0.3813449098066498, https://leetcode.com/problems/word-pattern
1236,Web Crawler,64.3%,Medium,0.33647223662121295, https://leetcode.com/problems/web-crawler
146,LRU Cache,33.2%,Medium,0.31735278471778255, https://leetcode.com/problems/lru-cache
1010,Pairs of Songs With Total Durations Divisible by 60,47.4%,Easy,0.09171392769013605, https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
140,Word Break II,32.6%,Hard,0.07881168148917794, https://leetcode.com/problems/word-break-ii
1,Two Sum,45.6%,Easy,0.016487580637467636, https://leetcode.com/problems/two-sum
4,Median of Two Sorted Arrays,29.6%,Hard,0.015510198481701449, https://leetcode.com/problems/median-of-two-sorted-arrays
64,Minimum Path Sum,54.5%,Medium,0.013734383449598314, https://leetcode.com/problems/minimum-path-sum
28,Implement strStr(),34.5%,Easy,0.008850485542574548, https://leetcode.com/problems/implement-strstr
1250,Check If It Is a Good Array,55.7%,Hard,0, https://leetcode.com/problems/check-if-it-is-a-good-array
1 609 ID Find Duplicate File in System Title 59.5% Acceptance Medium Difficulty 5.67594859888821 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 4.950737575757486 5.67594859888821 https://leetcode.com/problems/game-of-life https://leetcode.com/problems/find-duplicate-file-in-system
3 924 289 Minimize Malware Spread Game of Life 42.0% 54.5% Hard Medium 4.0636699251252715 4.950737575757486 https://leetcode.com/problems/minimize-malware-spread https://leetcode.com/problems/game-of-life
4 379 924 Design Phone Directory Minimize Malware Spread 46.8% 42.0% Medium Hard 3.4802548518846486 4.0636699251252715 https://leetcode.com/problems/design-phone-directory https://leetcode.com/problems/minimize-malware-spread
5 291 379 Word Pattern II Design Phone Directory 43.4% 46.8% Hard Medium 3.080206637191811 3.4802548518846486 https://leetcode.com/problems/word-pattern-ii https://leetcode.com/problems/design-phone-directory
6 362 291 Design Hit Counter Word Pattern II 63.7% 43.4% Medium Hard 2.7212063428291313 3.080206637191811 https://leetcode.com/problems/design-hit-counter https://leetcode.com/problems/word-pattern-ii
7 928 362 Minimize Malware Spread II Design Hit Counter 40.5% 63.7% Hard Medium 1.8341386921969165 2.7212063428291313 https://leetcode.com/problems/minimize-malware-spread-ii https://leetcode.com/problems/design-hit-counter
8 1242 928 Web Crawler Multithreaded Minimize Malware Spread II 45.9% 40.5% Medium Hard 1.7713921664036212 1.8341386921969165 https://leetcode.com/problems/web-crawler-multithreaded https://leetcode.com/problems/minimize-malware-spread-ii
9 1178 1242 Number of Valid Words for Each Puzzle Web Crawler Multithreaded 37.8% 45.9% Hard Medium 1.0828639316999706 1.7713921664036212 https://leetcode.com/problems/number-of-valid-words-for-each-puzzle https://leetcode.com/problems/web-crawler-multithreaded
10 1001 1178 Grid Illumination Number of Valid Words for Each Puzzle 35.9% 37.8% Hard Hard 1.0479685558493548 1.0828639316999706 https://leetcode.com/problems/grid-illumination https://leetcode.com/problems/number-of-valid-words-for-each-puzzle
11 642 1001 Design Search Autocomplete System Grid Illumination 44.7% 35.9% Hard Hard 0.9534648850908103 1.0479685558493548 https://leetcode.com/problems/design-search-autocomplete-system https://leetcode.com/problems/grid-illumination
12 17 642 Letter Combinations of a Phone Number Design Search Autocomplete System 46.8% 44.7% Medium Hard 0.8219594485525382 0.9534648850908103 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/design-search-autocomplete-system
13 290 17 Word Pattern Letter Combinations of a Phone Number 37.0% 46.8% Easy Medium 0.3813449098066498 0.8219594485525382 https://leetcode.com/problems/word-pattern https://leetcode.com/problems/letter-combinations-of-a-phone-number
14 1236 290 Web Crawler Word Pattern 64.3% 37.0% Medium Easy 0.33647223662121295 0.3813449098066498 https://leetcode.com/problems/web-crawler https://leetcode.com/problems/word-pattern
15 146 1236 LRU Cache Web Crawler 33.2% 64.3% Medium Medium 0.31735278471778255 0.33647223662121295 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/web-crawler
16 1010 146 Pairs of Songs With Total Durations Divisible by 60 LRU Cache 47.4% 33.2% Easy Medium 0.09171392769013605 0.31735278471778255 https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60 https://leetcode.com/problems/lru-cache
17 140 1010 Word Break II Pairs of Songs With Total Durations Divisible by 60 32.6% 47.4% Hard Easy 0.07881168148917794 0.09171392769013605 https://leetcode.com/problems/word-break-ii https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
18 1 140 Two Sum Word Break II 45.6% 32.6% Easy Hard 0.016487580637467636 0.07881168148917794 https://leetcode.com/problems/two-sum https://leetcode.com/problems/word-break-ii
19 4 1 Median of Two Sorted Arrays Two Sum 29.6% 45.6% Hard Easy 0.015510198481701449 0.016487580637467636 https://leetcode.com/problems/median-of-two-sorted-arrays https://leetcode.com/problems/two-sum
20 64 4 Minimum Path Sum Median of Two Sorted Arrays 54.5% 29.6% Medium Hard 0.013734383449598314 0.015510198481701449 https://leetcode.com/problems/minimum-path-sum https://leetcode.com/problems/median-of-two-sorted-arrays
21 28 64 Implement strStr() Minimum Path Sum 34.5% 54.5% Easy Medium 0.008850485542574548 0.013734383449598314 https://leetcode.com/problems/implement-strstr https://leetcode.com/problems/minimum-path-sum
22 1250 28 Check If It Is a Good Array Implement strStr() 55.7% 34.5% Hard Easy 0 0.008850485542574548 https://leetcode.com/problems/check-if-it-is-a-good-array https://leetcode.com/problems/implement-strstr
23 1250 Check If It Is a Good Array 55.7% Hard 0 https://leetcode.com/problems/check-if-it-is-a-good-array