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 @@
1130,Minimum Cost Tree From Leaf Values,66.1%,Medium,1.583844915245196, https://leetcode.com/problems/minimum-cost-tree-from-leaf-values
255,Verify Preorder Sequence in Binary Search Tree,45.7%,Medium,1.0184692951799177, https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree
1163,Last Substring in Lexicographical Order,33.9%,Hard,0.9532793012434956, https://leetcode.com/problems/last-substring-in-lexicographical-order
317,Shortest Distance from All Buildings,41.4%,Hard,0.3879036811782171, https://leetcode.com/problems/shortest-distance-from-all-buildings
25,Reverse Nodes in k-Group,42.1%,Hard,0.22841574636360815, https://leetcode.com/problems/reverse-nodes-in-k-group
500,Keyboard Row,64.7%,Easy,0.19290366612449156, https://leetcode.com/problems/keyboard-row
526,Beautiful Arrangement,57.8%,Medium,0.17351092711179975, https://leetcode.com/problems/beautiful-arrangement
206,Reverse Linked List,62.5%,Easy,0.12378418901663191, https://leetcode.com/problems/reverse-linked-list
741,Cherry Pickup,33.9%,Hard,0.12293768624504794, https://leetcode.com/problems/cherry-pickup
259,3Sum Smaller,47.6%,Medium,0.10814850377723753, https://leetcode.com/problems/3sum-smaller
697,Degree of an Array,53.8%,Easy,0.07117627846789498, https://leetcode.com/problems/degree-of-an-array
115,Distinct Subsequences,38.3%,Hard,0.061494781607806234, https://leetcode.com/problems/distinct-subsequences
1319,Number of Operations to Make Network Connected,53.1%,Medium,0.04587960575069364, https://leetcode.com/problems/number-of-operations-to-make-network-connected
232,Implement Queue using Stacks,49.6%,Easy,0.04423053722733957, https://leetcode.com/problems/implement-queue-using-stacks
63,Unique Paths II,34.6%,Medium,0.03440459729940371, https://leetcode.com/problems/unique-paths-ii
62,Unique Paths,54.1%,Medium,0.02853749186115581, https://leetcode.com/problems/unique-paths
338,Counting Bits,69.5%,Medium,0.024325523767440974, https://leetcode.com/problems/counting-bits
49,Group Anagrams,56.9%,Medium,0.02354157682187747, https://leetcode.com/problems/group-anagrams
225,Implement Stack using Queues,45.1%,Easy,0.01644097863345757, https://leetcode.com/problems/implement-stack-using-queues
647,Palindromic Substrings,60.6%,Medium,0.010400509768078022, https://leetcode.com/problems/palindromic-substrings
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
1,Two Sum,45.6%,Easy,0.00184543512358731, https://leetcode.com/problems/two-sum
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1130,Minimum Cost Tree From Leaf Values,66.1%,Medium,1.583844915245196, https://leetcode.com/problems/minimum-cost-tree-from-leaf-values
255,Verify Preorder Sequence in Binary Search Tree,45.7%,Medium,1.0184692951799177, https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree
1163,Last Substring in Lexicographical Order,33.9%,Hard,0.9532793012434956, https://leetcode.com/problems/last-substring-in-lexicographical-order
317,Shortest Distance from All Buildings,41.4%,Hard,0.3879036811782171, https://leetcode.com/problems/shortest-distance-from-all-buildings
25,Reverse Nodes in k-Group,42.1%,Hard,0.22841574636360815, https://leetcode.com/problems/reverse-nodes-in-k-group
500,Keyboard Row,64.7%,Easy,0.19290366612449156, https://leetcode.com/problems/keyboard-row
526,Beautiful Arrangement,57.8%,Medium,0.17351092711179975, https://leetcode.com/problems/beautiful-arrangement
206,Reverse Linked List,62.5%,Easy,0.12378418901663191, https://leetcode.com/problems/reverse-linked-list
741,Cherry Pickup,33.9%,Hard,0.12293768624504794, https://leetcode.com/problems/cherry-pickup
259,3Sum Smaller,47.6%,Medium,0.10814850377723753, https://leetcode.com/problems/3sum-smaller
697,Degree of an Array,53.8%,Easy,0.07117627846789498, https://leetcode.com/problems/degree-of-an-array
115,Distinct Subsequences,38.3%,Hard,0.061494781607806234, https://leetcode.com/problems/distinct-subsequences
1319,Number of Operations to Make Network Connected,53.1%,Medium,0.04587960575069364, https://leetcode.com/problems/number-of-operations-to-make-network-connected
232,Implement Queue using Stacks,49.6%,Easy,0.04423053722733957, https://leetcode.com/problems/implement-queue-using-stacks
63,Unique Paths II,34.6%,Medium,0.03440459729940371, https://leetcode.com/problems/unique-paths-ii
62,Unique Paths,54.1%,Medium,0.02853749186115581, https://leetcode.com/problems/unique-paths
338,Counting Bits,69.5%,Medium,0.024325523767440974, https://leetcode.com/problems/counting-bits
49,Group Anagrams,56.9%,Medium,0.02354157682187747, https://leetcode.com/problems/group-anagrams
225,Implement Stack using Queues,45.1%,Easy,0.01644097863345757, https://leetcode.com/problems/implement-stack-using-queues
647,Palindromic Substrings,60.6%,Medium,0.010400509768078022, https://leetcode.com/problems/palindromic-substrings
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
1,Two Sum,45.6%,Easy,0.00184543512358731, https://leetcode.com/problems/two-sum
1 1130 ID Minimum Cost Tree From Leaf Values Title 66.1% Acceptance Medium Difficulty 1.583844915245196 Frequency https://leetcode.com/problems/minimum-cost-tree-from-leaf-values Leetcode Question Link
2 255 1130 Verify Preorder Sequence in Binary Search Tree Minimum Cost Tree From Leaf Values 45.7% 66.1% Medium Medium 1.0184692951799177 1.583844915245196 https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree https://leetcode.com/problems/minimum-cost-tree-from-leaf-values
3 1163 255 Last Substring in Lexicographical Order Verify Preorder Sequence in Binary Search Tree 33.9% 45.7% Hard Medium 0.9532793012434956 1.0184692951799177 https://leetcode.com/problems/last-substring-in-lexicographical-order https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree
4 317 1163 Shortest Distance from All Buildings Last Substring in Lexicographical Order 41.4% 33.9% Hard Hard 0.3879036811782171 0.9532793012434956 https://leetcode.com/problems/shortest-distance-from-all-buildings https://leetcode.com/problems/last-substring-in-lexicographical-order
5 25 317 Reverse Nodes in k-Group Shortest Distance from All Buildings 42.1% 41.4% Hard Hard 0.22841574636360815 0.3879036811782171 https://leetcode.com/problems/reverse-nodes-in-k-group https://leetcode.com/problems/shortest-distance-from-all-buildings
6 500 25 Keyboard Row Reverse Nodes in k-Group 64.7% 42.1% Easy Hard 0.19290366612449156 0.22841574636360815 https://leetcode.com/problems/keyboard-row https://leetcode.com/problems/reverse-nodes-in-k-group
7 526 500 Beautiful Arrangement Keyboard Row 57.8% 64.7% Medium Easy 0.17351092711179975 0.19290366612449156 https://leetcode.com/problems/beautiful-arrangement https://leetcode.com/problems/keyboard-row
8 206 526 Reverse Linked List Beautiful Arrangement 62.5% 57.8% Easy Medium 0.12378418901663191 0.17351092711179975 https://leetcode.com/problems/reverse-linked-list https://leetcode.com/problems/beautiful-arrangement
9 741 206 Cherry Pickup Reverse Linked List 33.9% 62.5% Hard Easy 0.12293768624504794 0.12378418901663191 https://leetcode.com/problems/cherry-pickup https://leetcode.com/problems/reverse-linked-list
10 259 741 3Sum Smaller Cherry Pickup 47.6% 33.9% Medium Hard 0.10814850377723753 0.12293768624504794 https://leetcode.com/problems/3sum-smaller https://leetcode.com/problems/cherry-pickup
11 697 259 Degree of an Array 3Sum Smaller 53.8% 47.6% Easy Medium 0.07117627846789498 0.10814850377723753 https://leetcode.com/problems/degree-of-an-array https://leetcode.com/problems/3sum-smaller
12 115 697 Distinct Subsequences Degree of an Array 38.3% 53.8% Hard Easy 0.061494781607806234 0.07117627846789498 https://leetcode.com/problems/distinct-subsequences https://leetcode.com/problems/degree-of-an-array
13 1319 115 Number of Operations to Make Network Connected Distinct Subsequences 53.1% 38.3% Medium Hard 0.04587960575069364 0.061494781607806234 https://leetcode.com/problems/number-of-operations-to-make-network-connected https://leetcode.com/problems/distinct-subsequences
14 232 1319 Implement Queue using Stacks Number of Operations to Make Network Connected 49.6% 53.1% Easy Medium 0.04423053722733957 0.04587960575069364 https://leetcode.com/problems/implement-queue-using-stacks https://leetcode.com/problems/number-of-operations-to-make-network-connected
15 63 232 Unique Paths II Implement Queue using Stacks 34.6% 49.6% Medium Easy 0.03440459729940371 0.04423053722733957 https://leetcode.com/problems/unique-paths-ii https://leetcode.com/problems/implement-queue-using-stacks
16 62 63 Unique Paths Unique Paths II 54.1% 34.6% Medium Medium 0.02853749186115581 0.03440459729940371 https://leetcode.com/problems/unique-paths https://leetcode.com/problems/unique-paths-ii
17 338 62 Counting Bits Unique Paths 69.5% 54.1% Medium Medium 0.024325523767440974 0.02853749186115581 https://leetcode.com/problems/counting-bits https://leetcode.com/problems/unique-paths
18 49 338 Group Anagrams Counting Bits 56.9% 69.5% Medium Medium 0.02354157682187747 0.024325523767440974 https://leetcode.com/problems/group-anagrams https://leetcode.com/problems/counting-bits
19 225 49 Implement Stack using Queues Group Anagrams 45.1% 56.9% Easy Medium 0.01644097863345757 0.02354157682187747 https://leetcode.com/problems/implement-stack-using-queues https://leetcode.com/problems/group-anagrams
20 647 225 Palindromic Substrings Implement Stack using Queues 60.6% 45.1% Medium Easy 0.010400509768078022 0.01644097863345757 https://leetcode.com/problems/palindromic-substrings https://leetcode.com/problems/implement-stack-using-queues
21 15 647 3Sum Palindromic Substrings 26.8% 60.6% Medium Medium 0.004940992758742591 0.010400509768078022 https://leetcode.com/problems/3sum https://leetcode.com/problems/palindromic-substrings
22 200 15 Number of Islands 3Sum 46.8% 26.8% Medium Medium 0.0028897578265903614 0.004940992758742591 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/3sum
23 20 200 Valid Parentheses Number of Islands 39.0% 46.8% Easy Medium 0.0023005704055949323 0.0028897578265903614 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/number-of-islands
24 1 20 Two Sum Valid Parentheses 45.6% 39.0% Easy Easy 0.00184543512358731 0.0023005704055949323 https://leetcode.com/problems/two-sum https://leetcode.com/problems/valid-parentheses
25 1 Two Sum 45.6% Easy 0.00184543512358731 https://leetcode.com/problems/two-sum