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,15 +1,16 @@
829,Consecutive Numbers Sum,37.5%,Hard,0.28481507092935865, https://leetcode.com/problems/consecutive-numbers-sum
285,Inorder Successor in BST,40.4%,Medium,0.1850469943157836, https://leetcode.com/problems/inorder-successor-in-bst
241,Different Ways to Add Parentheses,55.2%,Medium,0.08527891770220855, https://leetcode.com/problems/different-ways-to-add-parentheses
1048,Longest String Chain,54.7%,Medium,0.07529425330187599, https://leetcode.com/problems/longest-string-chain
935,Knight Dialer,45.2%,Medium,0.04445176257083384, https://leetcode.com/problems/knight-dialer
20,Valid Parentheses,39.0%,Easy,0.02782373445001039, https://leetcode.com/problems/valid-parentheses
628,Maximum Product of Three Numbers,47.1%,Easy,0.016529301951210565, https://leetcode.com/problems/maximum-product-of-three-numbers
85,Maximal Rectangle,37.7%,Hard,0.013333530869465187, https://leetcode.com/problems/maximal-rectangle
232,Implement Queue using Stacks,49.6%,Easy,0.011242389348933884, https://leetcode.com/problems/implement-queue-using-stacks
647,Palindromic Substrings,60.6%,Medium,0.010400509768078022, https://leetcode.com/problems/palindromic-substrings
221,Maximal Square,37.7%,Medium,0.00988638798855515, https://leetcode.com/problems/maximal-square
42,Trapping Rain Water,48.9%,Hard,0.009762524655659178, https://leetcode.com/problems/trapping-rain-water
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
239,Sliding Window Maximum,43.0%,Hard,0.007898935224534491, https://leetcode.com/problems/sliding-window-maximum
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
829,Consecutive Numbers Sum,37.5%,Hard,0.28481507092935865, https://leetcode.com/problems/consecutive-numbers-sum
285,Inorder Successor in BST,40.4%,Medium,0.1850469943157836, https://leetcode.com/problems/inorder-successor-in-bst
241,Different Ways to Add Parentheses,55.2%,Medium,0.08527891770220855, https://leetcode.com/problems/different-ways-to-add-parentheses
1048,Longest String Chain,54.7%,Medium,0.07529425330187599, https://leetcode.com/problems/longest-string-chain
935,Knight Dialer,45.2%,Medium,0.04445176257083384, https://leetcode.com/problems/knight-dialer
20,Valid Parentheses,39.0%,Easy,0.02782373445001039, https://leetcode.com/problems/valid-parentheses
628,Maximum Product of Three Numbers,47.1%,Easy,0.016529301951210565, https://leetcode.com/problems/maximum-product-of-three-numbers
85,Maximal Rectangle,37.7%,Hard,0.013333530869465187, https://leetcode.com/problems/maximal-rectangle
232,Implement Queue using Stacks,49.6%,Easy,0.011242389348933884, https://leetcode.com/problems/implement-queue-using-stacks
647,Palindromic Substrings,60.6%,Medium,0.010400509768078022, https://leetcode.com/problems/palindromic-substrings
221,Maximal Square,37.7%,Medium,0.00988638798855515, https://leetcode.com/problems/maximal-square
42,Trapping Rain Water,48.9%,Hard,0.009762524655659178, https://leetcode.com/problems/trapping-rain-water
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
239,Sliding Window Maximum,43.0%,Hard,0.007898935224534491, https://leetcode.com/problems/sliding-window-maximum
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
1 829 ID Consecutive Numbers Sum Title 37.5% Acceptance Hard Difficulty 0.28481507092935865 Frequency https://leetcode.com/problems/consecutive-numbers-sum Leetcode Question Link
2 285 829 Inorder Successor in BST Consecutive Numbers Sum 40.4% 37.5% Medium Hard 0.1850469943157836 0.28481507092935865 https://leetcode.com/problems/inorder-successor-in-bst https://leetcode.com/problems/consecutive-numbers-sum
3 241 285 Different Ways to Add Parentheses Inorder Successor in BST 55.2% 40.4% Medium Medium 0.08527891770220855 0.1850469943157836 https://leetcode.com/problems/different-ways-to-add-parentheses https://leetcode.com/problems/inorder-successor-in-bst
4 1048 241 Longest String Chain Different Ways to Add Parentheses 54.7% 55.2% Medium Medium 0.07529425330187599 0.08527891770220855 https://leetcode.com/problems/longest-string-chain https://leetcode.com/problems/different-ways-to-add-parentheses
5 935 1048 Knight Dialer Longest String Chain 45.2% 54.7% Medium Medium 0.04445176257083384 0.07529425330187599 https://leetcode.com/problems/knight-dialer https://leetcode.com/problems/longest-string-chain
6 20 935 Valid Parentheses Knight Dialer 39.0% 45.2% Easy Medium 0.02782373445001039 0.04445176257083384 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/knight-dialer
7 628 20 Maximum Product of Three Numbers Valid Parentheses 47.1% 39.0% Easy Easy 0.016529301951210565 0.02782373445001039 https://leetcode.com/problems/maximum-product-of-three-numbers https://leetcode.com/problems/valid-parentheses
8 85 628 Maximal Rectangle Maximum Product of Three Numbers 37.7% 47.1% Hard Easy 0.013333530869465187 0.016529301951210565 https://leetcode.com/problems/maximal-rectangle https://leetcode.com/problems/maximum-product-of-three-numbers
9 232 85 Implement Queue using Stacks Maximal Rectangle 49.6% 37.7% Easy Hard 0.011242389348933884 0.013333530869465187 https://leetcode.com/problems/implement-queue-using-stacks https://leetcode.com/problems/maximal-rectangle
10 647 232 Palindromic Substrings Implement Queue using Stacks 60.6% 49.6% Medium Easy 0.010400509768078022 0.011242389348933884 https://leetcode.com/problems/palindromic-substrings https://leetcode.com/problems/implement-queue-using-stacks
11 221 647 Maximal Square Palindromic Substrings 37.7% 60.6% Medium Medium 0.00988638798855515 0.010400509768078022 https://leetcode.com/problems/maximal-square https://leetcode.com/problems/palindromic-substrings
12 42 221 Trapping Rain Water Maximal Square 48.9% 37.7% Hard Medium 0.009762524655659178 0.00988638798855515 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/maximal-square
13 253 42 Meeting Rooms II Trapping Rain Water 45.7% 48.9% Medium Hard 0.008079219870546493 0.009762524655659178 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/trapping-rain-water
14 239 253 Sliding Window Maximum Meeting Rooms II 43.0% 45.7% Hard Medium 0.007898935224534491 0.008079219870546493 https://leetcode.com/problems/sliding-window-maximum https://leetcode.com/problems/meeting-rooms-ii
15 200 239 Number of Islands Sliding Window Maximum 46.8% 43.0% Medium Hard 0.0028897578265903614 0.007898935224534491 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/sliding-window-maximum
16 200 Number of Islands 46.8% Medium 0.0028897578265903614 https://leetcode.com/problems/number-of-islands