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,24 +1,25 @@
72,Edit Distance,44.8%,Hard,0.8278420197119241, https://leetcode.com/problems/edit-distance
271,Encode and Decode Strings,31.5%,Medium,0.6492888646599129, https://leetcode.com/problems/encode-and-decode-strings
969,Pancake Sorting,67.5%,Medium,0.5905780135393897, https://leetcode.com/problems/pancake-sorting
336,Palindrome Pairs,33.7%,Hard,0.5700227742957876, https://leetcode.com/problems/palindrome-pairs
999,Available Captures for Rook,66.7%,Easy,0.4868470419092762, https://leetcode.com/problems/available-captures-for-rook
91,Decode Ways,24.7%,Medium,0.32434096851350985, https://leetcode.com/problems/decode-ways
269,Alien Dictionary,33.3%,Hard,0.14578781346149866, https://leetcode.com/problems/alien-dictionary
273,Integer to English Words,27.1%,Hard,0.10380963271229693, https://leetcode.com/problems/integer-to-english-words
165,Compare Version Numbers,27.4%,Medium,0.09483978737982436, https://leetcode.com/problems/compare-version-numbers
415,Add Strings,47.5%,Easy,0.08919862525832246, https://leetcode.com/problems/add-strings
17,Letter Combinations of a Phone Number,46.8%,Medium,0.0855673732620712, https://leetcode.com/problems/letter-combinations-of-a-phone-number
277,Find the Celebrity,41.8%,Medium,0.06562120535847293, https://leetcode.com/problems/find-the-celebrity
208,Implement Trie (Prefix Tree),49.4%,Medium,0.05559457257530485, https://leetcode.com/problems/implement-trie-prefix-tree
127,Word Ladder,29.6%,Medium,0.05256684589504119, https://leetcode.com/problems/word-ladder
105,Construct Binary Tree from Preorder and Inorder Traversal,48.8%,Medium,0.049549146900389536, https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
824,Goat Latin,63.4%,Easy,0.0317991816929387, https://leetcode.com/problems/goat-latin
332,Reconstruct Itinerary,36.7%,Medium,0.030687713231237448, https://leetcode.com/problems/reconstruct-itinerary
981,Time Based Key-Value Store,53.1%,Medium,0.02226024024151985, https://leetcode.com/problems/time-based-key-value-store
15,3Sum,26.8%,Medium,0.013665148419080968, https://leetcode.com/problems/3sum
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
139,Word Break,40.1%,Medium,0.008741314401573542, https://leetcode.com/problems/word-break
39,Combination Sum,56.1%,Medium,0.005715934396440999, https://leetcode.com/problems/combination-sum
573,Squirrel Simulation,55.6%,Medium,0, https://leetcode.com/problems/squirrel-simulation
699,Falling Squares,41.8%,Hard,0, https://leetcode.com/problems/falling-squares
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
72,Edit Distance,44.8%,Hard,0.8278420197119241, https://leetcode.com/problems/edit-distance
271,Encode and Decode Strings,31.5%,Medium,0.6492888646599129, https://leetcode.com/problems/encode-and-decode-strings
969,Pancake Sorting,67.5%,Medium,0.5905780135393897, https://leetcode.com/problems/pancake-sorting
336,Palindrome Pairs,33.7%,Hard,0.5700227742957876, https://leetcode.com/problems/palindrome-pairs
999,Available Captures for Rook,66.7%,Easy,0.4868470419092762, https://leetcode.com/problems/available-captures-for-rook
91,Decode Ways,24.7%,Medium,0.32434096851350985, https://leetcode.com/problems/decode-ways
269,Alien Dictionary,33.3%,Hard,0.14578781346149866, https://leetcode.com/problems/alien-dictionary
273,Integer to English Words,27.1%,Hard,0.10380963271229693, https://leetcode.com/problems/integer-to-english-words
165,Compare Version Numbers,27.4%,Medium,0.09483978737982436, https://leetcode.com/problems/compare-version-numbers
415,Add Strings,47.5%,Easy,0.08919862525832246, https://leetcode.com/problems/add-strings
17,Letter Combinations of a Phone Number,46.8%,Medium,0.0855673732620712, https://leetcode.com/problems/letter-combinations-of-a-phone-number
277,Find the Celebrity,41.8%,Medium,0.06562120535847293, https://leetcode.com/problems/find-the-celebrity
208,Implement Trie (Prefix Tree),49.4%,Medium,0.05559457257530485, https://leetcode.com/problems/implement-trie-prefix-tree
127,Word Ladder,29.6%,Medium,0.05256684589504119, https://leetcode.com/problems/word-ladder
105,Construct Binary Tree from Preorder and Inorder Traversal,48.8%,Medium,0.049549146900389536, https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
824,Goat Latin,63.4%,Easy,0.0317991816929387, https://leetcode.com/problems/goat-latin
332,Reconstruct Itinerary,36.7%,Medium,0.030687713231237448, https://leetcode.com/problems/reconstruct-itinerary
981,Time Based Key-Value Store,53.1%,Medium,0.02226024024151985, https://leetcode.com/problems/time-based-key-value-store
15,3Sum,26.8%,Medium,0.013665148419080968, https://leetcode.com/problems/3sum
200,Number of Islands,46.8%,Medium,0.011509262420590827, https://leetcode.com/problems/number-of-islands
139,Word Break,40.1%,Medium,0.008741314401573542, https://leetcode.com/problems/word-break
39,Combination Sum,56.1%,Medium,0.005715934396440999, https://leetcode.com/problems/combination-sum
573,Squirrel Simulation,55.6%,Medium,0, https://leetcode.com/problems/squirrel-simulation
699,Falling Squares,41.8%,Hard,0, https://leetcode.com/problems/falling-squares
1 72 ID Edit Distance Title 44.8% Acceptance Hard Difficulty 0.8278420197119241 Frequency https://leetcode.com/problems/edit-distance Leetcode Question Link
2 271 72 Encode and Decode Strings Edit Distance 31.5% 44.8% Medium Hard 0.6492888646599129 0.8278420197119241 https://leetcode.com/problems/encode-and-decode-strings https://leetcode.com/problems/edit-distance
3 969 271 Pancake Sorting Encode and Decode Strings 67.5% 31.5% Medium Medium 0.5905780135393897 0.6492888646599129 https://leetcode.com/problems/pancake-sorting https://leetcode.com/problems/encode-and-decode-strings
4 336 969 Palindrome Pairs Pancake Sorting 33.7% 67.5% Hard Medium 0.5700227742957876 0.5905780135393897 https://leetcode.com/problems/palindrome-pairs https://leetcode.com/problems/pancake-sorting
5 999 336 Available Captures for Rook Palindrome Pairs 66.7% 33.7% Easy Hard 0.4868470419092762 0.5700227742957876 https://leetcode.com/problems/available-captures-for-rook https://leetcode.com/problems/palindrome-pairs
6 91 999 Decode Ways Available Captures for Rook 24.7% 66.7% Medium Easy 0.32434096851350985 0.4868470419092762 https://leetcode.com/problems/decode-ways https://leetcode.com/problems/available-captures-for-rook
7 269 91 Alien Dictionary Decode Ways 33.3% 24.7% Hard Medium 0.14578781346149866 0.32434096851350985 https://leetcode.com/problems/alien-dictionary https://leetcode.com/problems/decode-ways
8 273 269 Integer to English Words Alien Dictionary 27.1% 33.3% Hard Hard 0.10380963271229693 0.14578781346149866 https://leetcode.com/problems/integer-to-english-words https://leetcode.com/problems/alien-dictionary
9 165 273 Compare Version Numbers Integer to English Words 27.4% 27.1% Medium Hard 0.09483978737982436 0.10380963271229693 https://leetcode.com/problems/compare-version-numbers https://leetcode.com/problems/integer-to-english-words
10 415 165 Add Strings Compare Version Numbers 47.5% 27.4% Easy Medium 0.08919862525832246 0.09483978737982436 https://leetcode.com/problems/add-strings https://leetcode.com/problems/compare-version-numbers
11 17 415 Letter Combinations of a Phone Number Add Strings 46.8% 47.5% Medium Easy 0.0855673732620712 0.08919862525832246 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/add-strings
12 277 17 Find the Celebrity Letter Combinations of a Phone Number 41.8% 46.8% Medium Medium 0.06562120535847293 0.0855673732620712 https://leetcode.com/problems/find-the-celebrity https://leetcode.com/problems/letter-combinations-of-a-phone-number
13 208 277 Implement Trie (Prefix Tree) Find the Celebrity 49.4% 41.8% Medium Medium 0.05559457257530485 0.06562120535847293 https://leetcode.com/problems/implement-trie-prefix-tree https://leetcode.com/problems/find-the-celebrity
14 127 208 Word Ladder Implement Trie (Prefix Tree) 29.6% 49.4% Medium Medium 0.05256684589504119 0.05559457257530485 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/implement-trie-prefix-tree
15 105 127 Construct Binary Tree from Preorder and Inorder Traversal Word Ladder 48.8% 29.6% Medium Medium 0.049549146900389536 0.05256684589504119 https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal https://leetcode.com/problems/word-ladder
16 824 105 Goat Latin Construct Binary Tree from Preorder and Inorder Traversal 63.4% 48.8% Easy Medium 0.0317991816929387 0.049549146900389536 https://leetcode.com/problems/goat-latin https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
17 332 824 Reconstruct Itinerary Goat Latin 36.7% 63.4% Medium Easy 0.030687713231237448 0.0317991816929387 https://leetcode.com/problems/reconstruct-itinerary https://leetcode.com/problems/goat-latin
18 981 332 Time Based Key-Value Store Reconstruct Itinerary 53.1% 36.7% Medium Medium 0.02226024024151985 0.030687713231237448 https://leetcode.com/problems/time-based-key-value-store https://leetcode.com/problems/reconstruct-itinerary
19 15 981 3Sum Time Based Key-Value Store 26.8% 53.1% Medium Medium 0.013665148419080968 0.02226024024151985 https://leetcode.com/problems/3sum https://leetcode.com/problems/time-based-key-value-store
20 200 15 Number of Islands 3Sum 46.8% 26.8% Medium Medium 0.011509262420590827 0.013665148419080968 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/3sum
21 139 200 Word Break Number of Islands 40.1% 46.8% Medium Medium 0.008741314401573542 0.011509262420590827 https://leetcode.com/problems/word-break https://leetcode.com/problems/number-of-islands
22 39 139 Combination Sum Word Break 56.1% 40.1% Medium Medium 0.005715934396440999 0.008741314401573542 https://leetcode.com/problems/combination-sum https://leetcode.com/problems/word-break
23 573 39 Squirrel Simulation Combination Sum 55.6% 56.1% Medium Medium 0 0.005715934396440999 https://leetcode.com/problems/squirrel-simulation https://leetcode.com/problems/combination-sum
24 699 573 Falling Squares Squirrel Simulation 41.8% 55.6% Hard Medium 0 0 https://leetcode.com/problems/falling-squares https://leetcode.com/problems/squirrel-simulation
25 699 Falling Squares 41.8% Hard 0 https://leetcode.com/problems/falling-squares