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 @@
76,Minimum Window Substring,34.6%,Hard,0.03691000072068462, https://leetcode.com/problems/minimum-window-substring
845,Longest Mountain in Array,37.2%,Medium,0.029335507073925533, https://leetcode.com/problems/longest-mountain-in-array
25,Reverse Nodes in k-Group,42.1%,Hard,0.021761013427166447, https://leetcode.com/problems/reverse-nodes-in-k-group
166,Fraction to Recurring Decimal,21.6%,Medium,0.019305618894153366, https://leetcode.com/problems/fraction-to-recurring-decimal
269,Alien Dictionary,33.3%,Hard,0.01213975455061059, https://leetcode.com/problems/alien-dictionary
207,Course Schedule,43.1%,Medium,0.010625837876226181, https://leetcode.com/problems/course-schedule
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
23,Merge k Sorted Lists,40.2%,Hard,0.0038759738446929853, https://leetcode.com/problems/merge-k-sorted-lists
56,Merge Intervals,39.3%,Medium,0.0033129067901687907, https://leetcode.com/problems/merge-intervals
200,Number of Islands,46.8%,Medium,0.002765297303115152, https://leetcode.com/problems/number-of-islands
283,Move Zeroes,57.8%,Easy,0.002758622439079723, https://leetcode.com/problems/move-zeroes
26,Remove Duplicates from Sorted Array,45.1%,Easy,0.0018681118827202508, https://leetcode.com/problems/remove-duplicates-from-sorted-array
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
76,Minimum Window Substring,34.6%,Hard,0.03691000072068462, https://leetcode.com/problems/minimum-window-substring
845,Longest Mountain in Array,37.2%,Medium,0.029335507073925533, https://leetcode.com/problems/longest-mountain-in-array
25,Reverse Nodes in k-Group,42.1%,Hard,0.021761013427166447, https://leetcode.com/problems/reverse-nodes-in-k-group
166,Fraction to Recurring Decimal,21.6%,Medium,0.019305618894153366, https://leetcode.com/problems/fraction-to-recurring-decimal
269,Alien Dictionary,33.3%,Hard,0.01213975455061059, https://leetcode.com/problems/alien-dictionary
207,Course Schedule,43.1%,Medium,0.010625837876226181, https://leetcode.com/problems/course-schedule
127,Word Ladder,29.6%,Medium,0.005731495844689608, https://leetcode.com/problems/word-ladder
23,Merge k Sorted Lists,40.2%,Hard,0.0038759738446929853, https://leetcode.com/problems/merge-k-sorted-lists
56,Merge Intervals,39.3%,Medium,0.0033129067901687907, https://leetcode.com/problems/merge-intervals
200,Number of Islands,46.8%,Medium,0.002765297303115152, https://leetcode.com/problems/number-of-islands
283,Move Zeroes,57.8%,Easy,0.002758622439079723, https://leetcode.com/problems/move-zeroes
26,Remove Duplicates from Sorted Array,45.1%,Easy,0.0018681118827202508, https://leetcode.com/problems/remove-duplicates-from-sorted-array
1 76 ID Minimum Window Substring Title 34.6% Acceptance Hard Difficulty 0.03691000072068462 Frequency https://leetcode.com/problems/minimum-window-substring Leetcode Question Link
2 845 76 Longest Mountain in Array Minimum Window Substring 37.2% 34.6% Medium Hard 0.029335507073925533 0.03691000072068462 https://leetcode.com/problems/longest-mountain-in-array https://leetcode.com/problems/minimum-window-substring
3 25 845 Reverse Nodes in k-Group Longest Mountain in Array 42.1% 37.2% Hard Medium 0.021761013427166447 0.029335507073925533 https://leetcode.com/problems/reverse-nodes-in-k-group https://leetcode.com/problems/longest-mountain-in-array
4 166 25 Fraction to Recurring Decimal Reverse Nodes in k-Group 21.6% 42.1% Medium Hard 0.019305618894153366 0.021761013427166447 https://leetcode.com/problems/fraction-to-recurring-decimal https://leetcode.com/problems/reverse-nodes-in-k-group
5 269 166 Alien Dictionary Fraction to Recurring Decimal 33.3% 21.6% Hard Medium 0.01213975455061059 0.019305618894153366 https://leetcode.com/problems/alien-dictionary https://leetcode.com/problems/fraction-to-recurring-decimal
6 207 269 Course Schedule Alien Dictionary 43.1% 33.3% Medium Hard 0.010625837876226181 0.01213975455061059 https://leetcode.com/problems/course-schedule https://leetcode.com/problems/alien-dictionary
7 127 207 Word Ladder Course Schedule 29.6% 43.1% Medium Medium 0.005731495844689608 0.010625837876226181 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/course-schedule
8 23 127 Merge k Sorted Lists Word Ladder 40.2% 29.6% Hard Medium 0.0038759738446929853 0.005731495844689608 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/word-ladder
9 56 23 Merge Intervals Merge k Sorted Lists 39.3% 40.2% Medium Hard 0.0033129067901687907 0.0038759738446929853 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/merge-k-sorted-lists
10 200 56 Number of Islands Merge Intervals 46.8% 39.3% Medium Medium 0.002765297303115152 0.0033129067901687907 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/merge-intervals
11 283 200 Move Zeroes Number of Islands 57.8% 46.8% Easy Medium 0.002758622439079723 0.002765297303115152 https://leetcode.com/problems/move-zeroes https://leetcode.com/problems/number-of-islands
12 26 283 Remove Duplicates from Sorted Array Move Zeroes 45.1% 57.8% Easy Easy 0.0018681118827202508 0.002758622439079723 https://leetcode.com/problems/remove-duplicates-from-sorted-array https://leetcode.com/problems/move-zeroes
13 26 Remove Duplicates from Sorted Array 45.1% Easy 0.0018681118827202508 https://leetcode.com/problems/remove-duplicates-from-sorted-array