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 @@
271,Encode and Decode Strings,31.5%,Medium,0.456074830875999, https://leetcode.com/problems/encode-and-decode-strings
336,Palindrome Pairs,33.7%,Hard,0.3591927799310734, https://leetcode.com/problems/palindrome-pairs
969,Pancake Sorting,67.5%,Medium,0.27343004974457946, https://leetcode.com/problems/pancake-sorting
999,Available Captures for Rook,66.7%,Easy,0.24587963229494916, https://leetcode.com/problems/available-captures-for-rook
72,Edit Distance,44.8%,Hard,0.14935692774322157, https://leetcode.com/problems/edit-distance
91,Decode Ways,24.7%,Medium,0.05247487679829598, https://leetcode.com/problems/decode-ways
127,Word Ladder,29.6%,Medium,0.03679590970204585, https://leetcode.com/problems/word-ladder
165,Compare Version Numbers,27.4%,Medium,0.0351873674509732, https://leetcode.com/problems/compare-version-numbers
824,Goat Latin,63.4%,Easy,0.0317991816929387, https://leetcode.com/problems/goat-latin
415,Add Strings,47.5%,Easy,0.030009753867991852, https://leetcode.com/problems/add-strings
277,Find the Celebrity,41.8%,Medium,0.02969780239174205, https://leetcode.com/problems/find-the-celebrity
273,Integer to English Words,27.1%,Hard,0.026980053764546055, https://leetcode.com/problems/integer-to-english-words
981,Time Based Key-Value Store,53.1%,Medium,0.02226024024151985, https://leetcode.com/problems/time-based-key-value-store
332,Reconstruct Itinerary,36.7%,Medium,0.013755375068485329, https://leetcode.com/problems/reconstruct-itinerary
269,Alien Dictionary,33.3%,Hard,0.012730916694039954, https://leetcode.com/problems/alien-dictionary
208,Implement Trie (Prefix Tree),49.4%,Medium,0.009105457856626612, https://leetcode.com/problems/implement-trie-prefix-tree
39,Combination Sum,56.1%,Medium,0.005715934396440999, https://leetcode.com/problems/combination-sum
105,Construct Binary Tree from Preorder and Inorder Traversal,48.8%,Medium,0.005628268691614718, https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
17,Letter Combinations of a Phone Number,46.8%,Medium,0.0044018999217624675, https://leetcode.com/problems/letter-combinations-of-a-phone-number
139,Word Break,40.1%,Medium,0.003894465052690167, https://leetcode.com/problems/word-break
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
271,Encode and Decode Strings,31.5%,Medium,0.456074830875999, https://leetcode.com/problems/encode-and-decode-strings
336,Palindrome Pairs,33.7%,Hard,0.3591927799310734, https://leetcode.com/problems/palindrome-pairs
969,Pancake Sorting,67.5%,Medium,0.27343004974457946, https://leetcode.com/problems/pancake-sorting
999,Available Captures for Rook,66.7%,Easy,0.24587963229494916, https://leetcode.com/problems/available-captures-for-rook
72,Edit Distance,44.8%,Hard,0.14935692774322157, https://leetcode.com/problems/edit-distance
91,Decode Ways,24.7%,Medium,0.05247487679829598, https://leetcode.com/problems/decode-ways
127,Word Ladder,29.6%,Medium,0.03679590970204585, https://leetcode.com/problems/word-ladder
165,Compare Version Numbers,27.4%,Medium,0.0351873674509732, https://leetcode.com/problems/compare-version-numbers
824,Goat Latin,63.4%,Easy,0.0317991816929387, https://leetcode.com/problems/goat-latin
415,Add Strings,47.5%,Easy,0.030009753867991852, https://leetcode.com/problems/add-strings
277,Find the Celebrity,41.8%,Medium,0.02969780239174205, https://leetcode.com/problems/find-the-celebrity
273,Integer to English Words,27.1%,Hard,0.026980053764546055, https://leetcode.com/problems/integer-to-english-words
981,Time Based Key-Value Store,53.1%,Medium,0.02226024024151985, https://leetcode.com/problems/time-based-key-value-store
332,Reconstruct Itinerary,36.7%,Medium,0.013755375068485329, https://leetcode.com/problems/reconstruct-itinerary
269,Alien Dictionary,33.3%,Hard,0.012730916694039954, https://leetcode.com/problems/alien-dictionary
208,Implement Trie (Prefix Tree),49.4%,Medium,0.009105457856626612, https://leetcode.com/problems/implement-trie-prefix-tree
39,Combination Sum,56.1%,Medium,0.005715934396440999, https://leetcode.com/problems/combination-sum
105,Construct Binary Tree from Preorder and Inorder Traversal,48.8%,Medium,0.005628268691614718, https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
17,Letter Combinations of a Phone Number,46.8%,Medium,0.0044018999217624675, https://leetcode.com/problems/letter-combinations-of-a-phone-number
139,Word Break,40.1%,Medium,0.003894465052690167, https://leetcode.com/problems/word-break
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
1 271 ID Encode and Decode Strings Title 31.5% Acceptance Medium Difficulty 0.456074830875999 Frequency https://leetcode.com/problems/encode-and-decode-strings Leetcode Question Link
2 336 271 Palindrome Pairs Encode and Decode Strings 33.7% 31.5% Hard Medium 0.3591927799310734 0.456074830875999 https://leetcode.com/problems/palindrome-pairs https://leetcode.com/problems/encode-and-decode-strings
3 969 336 Pancake Sorting Palindrome Pairs 67.5% 33.7% Medium Hard 0.27343004974457946 0.3591927799310734 https://leetcode.com/problems/pancake-sorting https://leetcode.com/problems/palindrome-pairs
4 999 969 Available Captures for Rook Pancake Sorting 66.7% 67.5% Easy Medium 0.24587963229494916 0.27343004974457946 https://leetcode.com/problems/available-captures-for-rook https://leetcode.com/problems/pancake-sorting
5 72 999 Edit Distance Available Captures for Rook 44.8% 66.7% Hard Easy 0.14935692774322157 0.24587963229494916 https://leetcode.com/problems/edit-distance https://leetcode.com/problems/available-captures-for-rook
6 91 72 Decode Ways Edit Distance 24.7% 44.8% Medium Hard 0.05247487679829598 0.14935692774322157 https://leetcode.com/problems/decode-ways https://leetcode.com/problems/edit-distance
7 127 91 Word Ladder Decode Ways 29.6% 24.7% Medium Medium 0.03679590970204585 0.05247487679829598 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/decode-ways
8 165 127 Compare Version Numbers Word Ladder 27.4% 29.6% Medium Medium 0.0351873674509732 0.03679590970204585 https://leetcode.com/problems/compare-version-numbers https://leetcode.com/problems/word-ladder
9 824 165 Goat Latin Compare Version Numbers 63.4% 27.4% Easy Medium 0.0317991816929387 0.0351873674509732 https://leetcode.com/problems/goat-latin https://leetcode.com/problems/compare-version-numbers
10 415 824 Add Strings Goat Latin 47.5% 63.4% Easy Easy 0.030009753867991852 0.0317991816929387 https://leetcode.com/problems/add-strings https://leetcode.com/problems/goat-latin
11 277 415 Find the Celebrity Add Strings 41.8% 47.5% Medium Easy 0.02969780239174205 0.030009753867991852 https://leetcode.com/problems/find-the-celebrity https://leetcode.com/problems/add-strings
12 273 277 Integer to English Words Find the Celebrity 27.1% 41.8% Hard Medium 0.026980053764546055 0.02969780239174205 https://leetcode.com/problems/integer-to-english-words https://leetcode.com/problems/find-the-celebrity
13 981 273 Time Based Key-Value Store Integer to English Words 53.1% 27.1% Medium Hard 0.02226024024151985 0.026980053764546055 https://leetcode.com/problems/time-based-key-value-store https://leetcode.com/problems/integer-to-english-words
14 332 981 Reconstruct Itinerary Time Based Key-Value Store 36.7% 53.1% Medium Medium 0.013755375068485329 0.02226024024151985 https://leetcode.com/problems/reconstruct-itinerary https://leetcode.com/problems/time-based-key-value-store
15 269 332 Alien Dictionary Reconstruct Itinerary 33.3% 36.7% Hard Medium 0.012730916694039954 0.013755375068485329 https://leetcode.com/problems/alien-dictionary https://leetcode.com/problems/reconstruct-itinerary
16 208 269 Implement Trie (Prefix Tree) Alien Dictionary 49.4% 33.3% Medium Hard 0.009105457856626612 0.012730916694039954 https://leetcode.com/problems/implement-trie-prefix-tree https://leetcode.com/problems/alien-dictionary
17 39 208 Combination Sum Implement Trie (Prefix Tree) 56.1% 49.4% Medium Medium 0.005715934396440999 0.009105457856626612 https://leetcode.com/problems/combination-sum https://leetcode.com/problems/implement-trie-prefix-tree
18 105 39 Construct Binary Tree from Preorder and Inorder Traversal Combination Sum 48.8% 56.1% Medium Medium 0.005628268691614718 0.005715934396440999 https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal https://leetcode.com/problems/combination-sum
19 15 105 3Sum Construct Binary Tree from Preorder and Inorder Traversal 26.8% 48.8% Medium Medium 0.004940992758742591 0.005628268691614718 https://leetcode.com/problems/3sum https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
20 17 15 Letter Combinations of a Phone Number 3Sum 46.8% 26.8% Medium Medium 0.0044018999217624675 0.004940992758742591 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/3sum
21 139 17 Word Break Letter Combinations of a Phone Number 40.1% 46.8% Medium Medium 0.003894465052690167 0.0044018999217624675 https://leetcode.com/problems/word-break https://leetcode.com/problems/letter-combinations-of-a-phone-number
22 200 139 Number of Islands Word Break 46.8% 40.1% Medium Medium 0.0028897578265903614 0.003894465052690167 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/word-break
23 200 Number of Islands 46.8% Medium 0.0028897578265903614 https://leetcode.com/problems/number-of-islands