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,12 +1,13 @@
736,Parse Lisp Expression,47.5%,Hard,1.0065947176467498, https://leetcode.com/problems/parse-lisp-expression
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.6946505634539769, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
695,Max Area of Island,62.7%,Medium,0.5227168031344483, https://leetcode.com/problems/max-area-of-island
380,Insert Delete GetRandom O(1),47.5%,Medium,0.2107726489416756, https://leetcode.com/problems/insert-delete-getrandom-o1
362,Design Hit Counter,63.7%,Medium,0.14310084364067333, https://leetcode.com/problems/design-hit-counter
49,Group Anagrams,56.9%,Medium,0.08712516204977415, https://leetcode.com/problems/group-anagrams
42,Trapping Rain Water,48.9%,Hard,0.08028083126080282, https://leetcode.com/problems/trapping-rain-water
127,Word Ladder,29.6%,Medium,0.06804400933142625, https://leetcode.com/problems/word-ladder
200,Number of Islands,46.8%,Medium,0.05455898425043439, https://leetcode.com/problems/number-of-islands
1,Two Sum,45.6%,Easy,0.04327015683483566, https://leetcode.com/problems/two-sum
322,Coin Change,35.5%,Medium,0.023903996947661692, https://leetcode.com/problems/coin-change
230,Kth Smallest Element in a BST,60.2%,Medium,0.006085520073802784, https://leetcode.com/problems/kth-smallest-element-in-a-bst
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
736,Parse Lisp Expression,47.5%,Hard,1.0065947176467498, https://leetcode.com/problems/parse-lisp-expression
381,Insert Delete GetRandom O(1) - Duplicates allowed,34.1%,Hard,0.6946505634539769, https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
695,Max Area of Island,62.7%,Medium,0.5227168031344483, https://leetcode.com/problems/max-area-of-island
380,Insert Delete GetRandom O(1),47.5%,Medium,0.2107726489416756, https://leetcode.com/problems/insert-delete-getrandom-o1
362,Design Hit Counter,63.7%,Medium,0.14310084364067333, https://leetcode.com/problems/design-hit-counter
49,Group Anagrams,56.9%,Medium,0.08712516204977415, https://leetcode.com/problems/group-anagrams
42,Trapping Rain Water,48.9%,Hard,0.08028083126080282, https://leetcode.com/problems/trapping-rain-water
127,Word Ladder,29.6%,Medium,0.06804400933142625, https://leetcode.com/problems/word-ladder
200,Number of Islands,46.8%,Medium,0.05455898425043439, https://leetcode.com/problems/number-of-islands
1,Two Sum,45.6%,Easy,0.04327015683483566, https://leetcode.com/problems/two-sum
322,Coin Change,35.5%,Medium,0.023903996947661692, https://leetcode.com/problems/coin-change
230,Kth Smallest Element in a BST,60.2%,Medium,0.006085520073802784, https://leetcode.com/problems/kth-smallest-element-in-a-bst
1 736 ID Parse Lisp Expression Title 47.5% Acceptance Hard Difficulty 1.0065947176467498 Frequency https://leetcode.com/problems/parse-lisp-expression Leetcode Question Link
2 381 736 Insert Delete GetRandom O(1) - Duplicates allowed Parse Lisp Expression 34.1% 47.5% Hard Hard 0.6946505634539769 1.0065947176467498 https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed https://leetcode.com/problems/parse-lisp-expression
3 695 381 Max Area of Island Insert Delete GetRandom O(1) - Duplicates allowed 62.7% 34.1% Medium Hard 0.5227168031344483 0.6946505634539769 https://leetcode.com/problems/max-area-of-island https://leetcode.com/problems/insert-delete-getrandom-o1-duplicates-allowed
4 380 695 Insert Delete GetRandom O(1) Max Area of Island 47.5% 62.7% Medium Medium 0.2107726489416756 0.5227168031344483 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/max-area-of-island
5 362 380 Design Hit Counter Insert Delete GetRandom O(1) 63.7% 47.5% Medium Medium 0.14310084364067333 0.2107726489416756 https://leetcode.com/problems/design-hit-counter https://leetcode.com/problems/insert-delete-getrandom-o1
6 49 362 Group Anagrams Design Hit Counter 56.9% 63.7% Medium Medium 0.08712516204977415 0.14310084364067333 https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/design-hit-counter
7 42 49 Trapping Rain Water Group Anagrams 48.9% 56.9% Hard Medium 0.08028083126080282 0.08712516204977415 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/group-anagrams
8 127 42 Word Ladder Trapping Rain Water 29.6% 48.9% Medium Hard 0.06804400933142625 0.08028083126080282 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/trapping-rain-water
9 200 127 Number of Islands Word Ladder 46.8% 29.6% Medium Medium 0.05455898425043439 0.06804400933142625 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/word-ladder
10 1 200 Two Sum Number of Islands 45.6% 46.8% Easy Medium 0.04327015683483566 0.05455898425043439 https://leetcode.com/problems/two-sum https://leetcode.com/problems/number-of-islands
11 322 1 Coin Change Two Sum 35.5% 45.6% Medium Easy 0.023903996947661692 0.04327015683483566 https://leetcode.com/problems/coin-change https://leetcode.com/problems/two-sum
12 230 322 Kth Smallest Element in a BST Coin Change 60.2% 35.5% Medium Medium 0.006085520073802784 0.023903996947661692 https://leetcode.com/problems/kth-smallest-element-in-a-bst https://leetcode.com/problems/coin-change
13 230 Kth Smallest Element in a BST 60.2% Medium 0.006085520073802784 https://leetcode.com/problems/kth-smallest-element-in-a-bst