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,30 +1,31 @@
923,3Sum With Multiplicity,35.7%,Medium,3.6540779400095724, https://leetcode.com/problems/3sum-with-multiplicity
855,Exam Room,43.1%,Medium,2.227706389329833, https://leetcode.com/problems/exam-room
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.8013348386500929, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
525,Contiguous Array,42.8%,Medium,0.661321343774057, https://leetcode.com/problems/contiguous-array
437,Path Sum III,47.2%,Medium,0.5566603463186759, https://leetcode.com/problems/path-sum-iii
498,Diagonal Traverse,48.2%,Medium,0.3533581913127385, https://leetcode.com/problems/diagonal-traverse
14,Longest Common Prefix,35.4%,Easy,0.276319223139963, https://leetcode.com/problems/longest-common-prefix
253,Meeting Rooms II,45.7%,Medium,0.24508053019079523, https://leetcode.com/problems/meeting-rooms-ii
113,Path Sum II,46.7%,Medium,0.2114436333734406, https://leetcode.com/problems/path-sum-ii
1053,Previous Permutation With One Swap,48.5%,Medium,0.20067069546215116, https://leetcode.com/problems/previous-permutation-with-one-swap
1329,Sort the Matrix Diagonally,78.4%,Medium,0.14787032803970862, https://leetcode.com/problems/sort-the-matrix-diagonally
162,Find Peak Element,43.3%,Medium,0.14169934441669452, https://leetcode.com/problems/find-peak-element
1027,Longest Arithmetic Sequence,53.4%,Medium,0.11122563511022437, https://leetcode.com/problems/longest-arithmetic-sequence
31,Next Permutation,32.6%,Medium,0.11042119699719148, https://leetcode.com/problems/next-permutation
380,Insert Delete GetRandom O(1),47.5%,Medium,0.1088270483839184, https://leetcode.com/problems/insert-delete-getrandom-o1
452,Minimum Number of Arrows to Burst Balloons,49.6%,Medium,0.10828689439229534, https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
852,Peak Index in a Mountain Array,71.6%,Easy,0.10417042076751157, https://leetcode.com/problems/peak-index-in-a-mountain-array
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
48,Rotate Image,56.7%,Medium,0.058128316417041546, https://leetcode.com/problems/rotate-image
15,3Sum,26.8%,Medium,0.04132186956190618, https://leetcode.com/problems/3sum
39,Combination Sum,56.1%,Medium,0.033569210052752915, https://leetcode.com/problems/combination-sum
1,Two Sum,45.6%,Easy,0.01579380422752371, https://leetcode.com/problems/two-sum
560,Subarray Sum Equals K,43.9%,Medium,0.00407664649376343, https://leetcode.com/problems/subarray-sum-equals-k
198,House Robber,42.0%,Easy,0.003611415987216383, https://leetcode.com/problems/house-robber
717,1-bit and 2-bit Characters,48.8%,Easy,0, https://leetcode.com/problems/1-bit-and-2-bit-characters
1256,Encode Number,66.1%,Medium,0, https://leetcode.com/problems/encode-number
1281,Subtract the Product and Sum of Digits of an Integer,85.2%,Easy,0, https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer
1295,Find Numbers with Even Number of Digits,81.5%,Easy,0, https://leetcode.com/problems/find-numbers-with-even-number-of-digits
1354,Construct Target Array With Multiple Sums,31.9%,Hard,0, https://leetcode.com/problems/construct-target-array-with-multiple-sums
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
923,3Sum With Multiplicity,35.7%,Medium,3.6540779400095724, https://leetcode.com/problems/3sum-with-multiplicity
855,Exam Room,43.1%,Medium,2.227706389329833, https://leetcode.com/problems/exam-room
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.8013348386500929, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
525,Contiguous Array,42.8%,Medium,0.661321343774057, https://leetcode.com/problems/contiguous-array
437,Path Sum III,47.2%,Medium,0.5566603463186759, https://leetcode.com/problems/path-sum-iii
498,Diagonal Traverse,48.2%,Medium,0.3533581913127385, https://leetcode.com/problems/diagonal-traverse
14,Longest Common Prefix,35.4%,Easy,0.276319223139963, https://leetcode.com/problems/longest-common-prefix
253,Meeting Rooms II,45.7%,Medium,0.24508053019079523, https://leetcode.com/problems/meeting-rooms-ii
113,Path Sum II,46.7%,Medium,0.2114436333734406, https://leetcode.com/problems/path-sum-ii
1053,Previous Permutation With One Swap,48.5%,Medium,0.20067069546215116, https://leetcode.com/problems/previous-permutation-with-one-swap
1329,Sort the Matrix Diagonally,78.4%,Medium,0.14787032803970862, https://leetcode.com/problems/sort-the-matrix-diagonally
162,Find Peak Element,43.3%,Medium,0.14169934441669452, https://leetcode.com/problems/find-peak-element
1027,Longest Arithmetic Sequence,53.4%,Medium,0.11122563511022437, https://leetcode.com/problems/longest-arithmetic-sequence
31,Next Permutation,32.6%,Medium,0.11042119699719148, https://leetcode.com/problems/next-permutation
380,Insert Delete GetRandom O(1),47.5%,Medium,0.1088270483839184, https://leetcode.com/problems/insert-delete-getrandom-o1
452,Minimum Number of Arrows to Burst Balloons,49.6%,Medium,0.10828689439229534, https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
852,Peak Index in a Mountain Array,71.6%,Easy,0.10417042076751157, https://leetcode.com/problems/peak-index-in-a-mountain-array
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
48,Rotate Image,56.7%,Medium,0.058128316417041546, https://leetcode.com/problems/rotate-image
15,3Sum,26.8%,Medium,0.04132186956190618, https://leetcode.com/problems/3sum
39,Combination Sum,56.1%,Medium,0.033569210052752915, https://leetcode.com/problems/combination-sum
1,Two Sum,45.6%,Easy,0.01579380422752371, https://leetcode.com/problems/two-sum
560,Subarray Sum Equals K,43.9%,Medium,0.00407664649376343, https://leetcode.com/problems/subarray-sum-equals-k
198,House Robber,42.0%,Easy,0.003611415987216383, https://leetcode.com/problems/house-robber
717,1-bit and 2-bit Characters,48.8%,Easy,0, https://leetcode.com/problems/1-bit-and-2-bit-characters
1256,Encode Number,66.1%,Medium,0, https://leetcode.com/problems/encode-number
1281,Subtract the Product and Sum of Digits of an Integer,85.2%,Easy,0, https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer
1295,Find Numbers with Even Number of Digits,81.5%,Easy,0, https://leetcode.com/problems/find-numbers-with-even-number-of-digits
1354,Construct Target Array With Multiple Sums,31.9%,Hard,0, https://leetcode.com/problems/construct-target-array-with-multiple-sums
1 923 ID 3Sum With Multiplicity Title 35.7% Acceptance Medium Difficulty 3.6540779400095724 Frequency https://leetcode.com/problems/3sum-with-multiplicity Leetcode Question Link
2 855 923 Exam Room 3Sum With Multiplicity 43.1% 35.7% Medium Medium 2.227706389329833 3.6540779400095724 https://leetcode.com/problems/exam-room https://leetcode.com/problems/3sum-with-multiplicity
3 297 855 Serialize and Deserialize Binary Tree Exam Room 47.5% 43.1% Hard Medium 0.8013348386500929 2.227706389329833 https://leetcode.com/problems/serialize-and-deserialize-binary-tree https://leetcode.com/problems/exam-room
4 525 297 Contiguous Array Serialize and Deserialize Binary Tree 42.8% 47.5% Medium Hard 0.661321343774057 0.8013348386500929 https://leetcode.com/problems/contiguous-array https://leetcode.com/problems/serialize-and-deserialize-binary-tree
5 437 525 Path Sum III Contiguous Array 47.2% 42.8% Medium Medium 0.5566603463186759 0.661321343774057 https://leetcode.com/problems/path-sum-iii https://leetcode.com/problems/contiguous-array
6 498 437 Diagonal Traverse Path Sum III 48.2% 47.2% Medium Medium 0.3533581913127385 0.5566603463186759 https://leetcode.com/problems/diagonal-traverse https://leetcode.com/problems/path-sum-iii
7 14 498 Longest Common Prefix Diagonal Traverse 35.4% 48.2% Easy Medium 0.276319223139963 0.3533581913127385 https://leetcode.com/problems/longest-common-prefix https://leetcode.com/problems/diagonal-traverse
8 253 14 Meeting Rooms II Longest Common Prefix 45.7% 35.4% Medium Easy 0.24508053019079523 0.276319223139963 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/longest-common-prefix
9 113 253 Path Sum II Meeting Rooms II 46.7% 45.7% Medium Medium 0.2114436333734406 0.24508053019079523 https://leetcode.com/problems/path-sum-ii https://leetcode.com/problems/meeting-rooms-ii
10 1053 113 Previous Permutation With One Swap Path Sum II 48.5% 46.7% Medium Medium 0.20067069546215116 0.2114436333734406 https://leetcode.com/problems/previous-permutation-with-one-swap https://leetcode.com/problems/path-sum-ii
11 1329 1053 Sort the Matrix Diagonally Previous Permutation With One Swap 78.4% 48.5% Medium Medium 0.14787032803970862 0.20067069546215116 https://leetcode.com/problems/sort-the-matrix-diagonally https://leetcode.com/problems/previous-permutation-with-one-swap
12 162 1329 Find Peak Element Sort the Matrix Diagonally 43.3% 78.4% Medium Medium 0.14169934441669452 0.14787032803970862 https://leetcode.com/problems/find-peak-element https://leetcode.com/problems/sort-the-matrix-diagonally
13 1027 162 Longest Arithmetic Sequence Find Peak Element 53.4% 43.3% Medium Medium 0.11122563511022437 0.14169934441669452 https://leetcode.com/problems/longest-arithmetic-sequence https://leetcode.com/problems/find-peak-element
14 31 1027 Next Permutation Longest Arithmetic Sequence 32.6% 53.4% Medium Medium 0.11042119699719148 0.11122563511022437 https://leetcode.com/problems/next-permutation https://leetcode.com/problems/longest-arithmetic-sequence
15 380 31 Insert Delete GetRandom O(1) Next Permutation 47.5% 32.6% Medium Medium 0.1088270483839184 0.11042119699719148 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/next-permutation
16 452 380 Minimum Number of Arrows to Burst Balloons Insert Delete GetRandom O(1) 49.6% 47.5% Medium Medium 0.10828689439229534 0.1088270483839184 https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons https://leetcode.com/problems/insert-delete-getrandom-o1
17 852 452 Peak Index in a Mountain Array Minimum Number of Arrows to Burst Balloons 71.6% 49.6% Easy Medium 0.10417042076751157 0.10828689439229534 https://leetcode.com/problems/peak-index-in-a-mountain-array https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
18 780 852 Reaching Points Peak Index in a Mountain Array 29.4% 71.6% Hard Easy 0.1040197878075301 0.10417042076751157 https://leetcode.com/problems/reaching-points https://leetcode.com/problems/peak-index-in-a-mountain-array
19 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
20 48 390 Rotate Image Elimination Game 56.7% 44.5% Medium Medium 0.058128316417041546 0.0922312242160336 https://leetcode.com/problems/rotate-image https://leetcode.com/problems/elimination-game
21 15 48 3Sum Rotate Image 26.8% 56.7% Medium Medium 0.04132186956190618 0.058128316417041546 https://leetcode.com/problems/3sum https://leetcode.com/problems/rotate-image
22 39 15 Combination Sum 3Sum 56.1% 26.8% Medium Medium 0.033569210052752915 0.04132186956190618 https://leetcode.com/problems/combination-sum https://leetcode.com/problems/3sum
23 1 39 Two Sum Combination Sum 45.6% 56.1% Easy Medium 0.01579380422752371 0.033569210052752915 https://leetcode.com/problems/two-sum https://leetcode.com/problems/combination-sum
24 560 1 Subarray Sum Equals K Two Sum 43.9% 45.6% Medium Easy 0.00407664649376343 0.01579380422752371 https://leetcode.com/problems/subarray-sum-equals-k https://leetcode.com/problems/two-sum
25 198 560 House Robber Subarray Sum Equals K 42.0% 43.9% Easy Medium 0.003611415987216383 0.00407664649376343 https://leetcode.com/problems/house-robber https://leetcode.com/problems/subarray-sum-equals-k
26 717 198 1-bit and 2-bit Characters House Robber 48.8% 42.0% Easy Easy 0 0.003611415987216383 https://leetcode.com/problems/1-bit-and-2-bit-characters https://leetcode.com/problems/house-robber
27 1256 717 Encode Number 1-bit and 2-bit Characters 66.1% 48.8% Medium Easy 0 0 https://leetcode.com/problems/encode-number https://leetcode.com/problems/1-bit-and-2-bit-characters
28 1281 1256 Subtract the Product and Sum of Digits of an Integer Encode Number 85.2% 66.1% Easy Medium 0 0 https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer https://leetcode.com/problems/encode-number
29 1295 1281 Find Numbers with Even Number of Digits Subtract the Product and Sum of Digits of an Integer 81.5% 85.2% Easy Easy 0 0 https://leetcode.com/problems/find-numbers-with-even-number-of-digits https://leetcode.com/problems/subtract-the-product-and-sum-of-digits-of-an-integer
30 1354 1295 Construct Target Array With Multiple Sums Find Numbers with Even Number of Digits 31.9% 81.5% Hard Easy 0 0 https://leetcode.com/problems/construct-target-array-with-multiple-sums https://leetcode.com/problems/find-numbers-with-even-number-of-digits
31 1354 Construct Target Array With Multiple Sums 31.9% Hard 0 https://leetcode.com/problems/construct-target-array-with-multiple-sums