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,17 +1,18 @@
525,Contiguous Array,42.8%,Medium,0.42990617361238165, https://leetcode.com/problems/contiguous-array
498,Diagonal Traverse,48.2%,Medium,0.32668133250056075, https://leetcode.com/problems/diagonal-traverse
855,Exam Room,43.1%,Medium,0.22345649138873985, https://leetcode.com/problems/exam-room
1053,Previous Permutation With One Swap,48.5%,Medium,0.20067069546215116, https://leetcode.com/problems/previous-permutation-with-one-swap
437,Path Sum III,47.2%,Medium,0.13327677772817573, https://leetcode.com/problems/path-sum-iii
1027,Longest Arithmetic Sequence,53.4%,Medium,0.11122563511022437, https://leetcode.com/problems/longest-arithmetic-sequence
780,Reaching Points,29.4%,Hard,0.1040197878075301, https://leetcode.com/problems/reaching-points
390,Elimination Game,44.5%,Medium,0.0922312242160336, https://leetcode.com/problems/elimination-game
1329,Sort the Matrix Diagonally,78.4%,Medium,0.08584868273025201, https://leetcode.com/problems/sort-the-matrix-diagonally
452,Minimum Number of Arrows to Burst Balloons,49.6%,Medium,0.06234705801852781, https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.05889827677358506, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
113,Path Sum II,46.7%,Medium,0.03698133452871584, https://leetcode.com/problems/path-sum-ii
253,Meeting Rooms II,45.7%,Medium,0.017208837680639542, https://leetcode.com/problems/meeting-rooms-ii
48,Rotate Image,56.7%,Medium,0.010933053508947611, https://leetcode.com/problems/rotate-image
380,Insert Delete GetRandom O(1),47.5%,Medium,0.00934149716911291, https://leetcode.com/problems/insert-delete-getrandom-o1
162,Find Peak Element,43.3%,Medium,0.006070742577979871, https://leetcode.com/problems/find-peak-element
560,Subarray Sum Equals K,43.9%,Medium,0.00407664649376343, https://leetcode.com/problems/subarray-sum-equals-k
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
525,Contiguous Array,42.8%,Medium,0.42990617361238165, https://leetcode.com/problems/contiguous-array
498,Diagonal Traverse,48.2%,Medium,0.32668133250056075, https://leetcode.com/problems/diagonal-traverse
855,Exam Room,43.1%,Medium,0.22345649138873985, https://leetcode.com/problems/exam-room
1053,Previous Permutation With One Swap,48.5%,Medium,0.20067069546215116, https://leetcode.com/problems/previous-permutation-with-one-swap
437,Path Sum III,47.2%,Medium,0.13327677772817573, https://leetcode.com/problems/path-sum-iii
1027,Longest Arithmetic Sequence,53.4%,Medium,0.11122563511022437, https://leetcode.com/problems/longest-arithmetic-sequence
780,Reaching Points,29.4%,Hard,0.1040197878075301, https://leetcode.com/problems/reaching-points
390,Elimination Game,44.5%,Medium,0.0922312242160336, https://leetcode.com/problems/elimination-game
1329,Sort the Matrix Diagonally,78.4%,Medium,0.08584868273025201, https://leetcode.com/problems/sort-the-matrix-diagonally
452,Minimum Number of Arrows to Burst Balloons,49.6%,Medium,0.06234705801852781, https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.05889827677358506, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
113,Path Sum II,46.7%,Medium,0.03698133452871584, https://leetcode.com/problems/path-sum-ii
253,Meeting Rooms II,45.7%,Medium,0.017208837680639542, https://leetcode.com/problems/meeting-rooms-ii
48,Rotate Image,56.7%,Medium,0.010933053508947611, https://leetcode.com/problems/rotate-image
380,Insert Delete GetRandom O(1),47.5%,Medium,0.00934149716911291, https://leetcode.com/problems/insert-delete-getrandom-o1
162,Find Peak Element,43.3%,Medium,0.006070742577979871, https://leetcode.com/problems/find-peak-element
560,Subarray Sum Equals K,43.9%,Medium,0.00407664649376343, https://leetcode.com/problems/subarray-sum-equals-k
1 525 ID Contiguous Array Title 42.8% Acceptance Medium Difficulty 0.42990617361238165 Frequency https://leetcode.com/problems/contiguous-array Leetcode Question Link
2 498 525 Diagonal Traverse Contiguous Array 48.2% 42.8% Medium Medium 0.32668133250056075 0.42990617361238165 https://leetcode.com/problems/diagonal-traverse https://leetcode.com/problems/contiguous-array
3 855 498 Exam Room Diagonal Traverse 43.1% 48.2% Medium Medium 0.22345649138873985 0.32668133250056075 https://leetcode.com/problems/exam-room https://leetcode.com/problems/diagonal-traverse
4 1053 855 Previous Permutation With One Swap Exam Room 48.5% 43.1% Medium Medium 0.20067069546215116 0.22345649138873985 https://leetcode.com/problems/previous-permutation-with-one-swap https://leetcode.com/problems/exam-room
5 437 1053 Path Sum III Previous Permutation With One Swap 47.2% 48.5% Medium Medium 0.13327677772817573 0.20067069546215116 https://leetcode.com/problems/path-sum-iii https://leetcode.com/problems/previous-permutation-with-one-swap
6 1027 437 Longest Arithmetic Sequence Path Sum III 53.4% 47.2% Medium Medium 0.11122563511022437 0.13327677772817573 https://leetcode.com/problems/longest-arithmetic-sequence https://leetcode.com/problems/path-sum-iii
7 780 1027 Reaching Points Longest Arithmetic Sequence 29.4% 53.4% Hard Medium 0.1040197878075301 0.11122563511022437 https://leetcode.com/problems/reaching-points https://leetcode.com/problems/longest-arithmetic-sequence
8 390 780 Elimination Game Reaching Points 44.5% 29.4% Medium Hard 0.0922312242160336 0.1040197878075301 https://leetcode.com/problems/elimination-game https://leetcode.com/problems/reaching-points
9 1329 390 Sort the Matrix Diagonally Elimination Game 78.4% 44.5% Medium Medium 0.08584868273025201 0.0922312242160336 https://leetcode.com/problems/sort-the-matrix-diagonally https://leetcode.com/problems/elimination-game
10 452 1329 Minimum Number of Arrows to Burst Balloons Sort the Matrix Diagonally 49.6% 78.4% Medium Medium 0.06234705801852781 0.08584868273025201 https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons https://leetcode.com/problems/sort-the-matrix-diagonally
11 297 452 Serialize and Deserialize Binary Tree Minimum Number of Arrows to Burst Balloons 47.5% 49.6% Hard Medium 0.05889827677358506 0.06234705801852781 https://leetcode.com/problems/serialize-and-deserialize-binary-tree https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
12 113 297 Path Sum II Serialize and Deserialize Binary Tree 46.7% 47.5% Medium Hard 0.03698133452871584 0.05889827677358506 https://leetcode.com/problems/path-sum-ii https://leetcode.com/problems/serialize-and-deserialize-binary-tree
13 253 113 Meeting Rooms II Path Sum II 45.7% 46.7% Medium Medium 0.017208837680639542 0.03698133452871584 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/path-sum-ii
14 48 253 Rotate Image Meeting Rooms II 56.7% 45.7% Medium Medium 0.010933053508947611 0.017208837680639542 https://leetcode.com/problems/rotate-image https://leetcode.com/problems/meeting-rooms-ii
15 380 48 Insert Delete GetRandom O(1) Rotate Image 47.5% 56.7% Medium Medium 0.00934149716911291 0.010933053508947611 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/rotate-image
16 162 380 Find Peak Element Insert Delete GetRandom O(1) 43.3% 47.5% Medium Medium 0.006070742577979871 0.00934149716911291 https://leetcode.com/problems/find-peak-element https://leetcode.com/problems/insert-delete-getrandom-o1
17 560 162 Subarray Sum Equals K Find Peak Element 43.9% 43.3% Medium Medium 0.00407664649376343 0.006070742577979871 https://leetcode.com/problems/subarray-sum-equals-k https://leetcode.com/problems/find-peak-element
18 560 Subarray Sum Equals K 43.9% Medium 0.00407664649376343 https://leetcode.com/problems/subarray-sum-equals-k