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