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,18 +1,19 @@
840,Magic Squares In Grid,37.3%,Easy,0.4449565940664958, https://leetcode.com/problems/magic-squares-in-grid
811,Subdomain Visit Count,69.9%,Easy,0.28185115214098777, https://leetcode.com/problems/subdomain-visit-count
1189,Maximum Number of Balloons,61.2%,Easy,0.11874571021547974, https://leetcode.com/problems/maximum-number-of-balloons
759,Employee Free Time,66.3%,Hard,0.10143824284548837, https://leetcode.com/problems/employee-free-time
1204,Last Person to Fit in the Elevator,69.8%,Medium,0.08515780834030685, https://leetcode.com/problems/last-person-to-fit-in-the-elevator
1212,Team Scores in Football Tournament,55.8%,Medium,0.07862594238342736, https://leetcode.com/problems/team-scores-in-football-tournament
443,String Compression,41.3%,Easy,0.052333720049023605, https://leetcode.com/problems/string-compression
85,Maximal Rectangle,37.7%,Hard,0.050135812424355455, https://leetcode.com/problems/maximal-rectangle
412,Fizz Buzz,62.3%,Easy,0.027152525030955416, https://leetcode.com/problems/fizz-buzz
718,Maximum Length of Repeated Subarray,49.4%,Medium,0.02699219201435624, https://leetcode.com/problems/maximum-length-of-repeated-subarray
5,Longest Palindromic Substring,29.5%,Medium,0.019425420619316486, https://leetcode.com/problems/longest-palindromic-substring
184,Department Highest Salary,36.7%,Medium,0.018018505502678313, https://leetcode.com/problems/department-highest-salary
125,Valid Palindrome,36.7%,Easy,0.015106027431013205, https://leetcode.com/problems/valid-palindrome
69,Sqrt(x),33.9%,Easy,0.010949014489670414, https://leetcode.com/problems/sqrtx
56,Merge Intervals,39.3%,Medium,0.0074386655924217485, https://leetcode.com/problems/merge-intervals
41,First Missing Positive,32.0%,Hard,0.006163347707668678, https://leetcode.com/problems/first-missing-positive
53,Maximum Subarray,46.5%,Easy,0.0020745819379855658, https://leetcode.com/problems/maximum-subarray
210,Course Schedule II,40.7%,Medium,0.0018850146957713153, https://leetcode.com/problems/course-schedule-ii
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
840,Magic Squares In Grid,37.3%,Easy,0.4449565940664958, https://leetcode.com/problems/magic-squares-in-grid
811,Subdomain Visit Count,69.9%,Easy,0.28185115214098777, https://leetcode.com/problems/subdomain-visit-count
1189,Maximum Number of Balloons,61.2%,Easy,0.11874571021547974, https://leetcode.com/problems/maximum-number-of-balloons
759,Employee Free Time,66.3%,Hard,0.10143824284548837, https://leetcode.com/problems/employee-free-time
1204,Last Person to Fit in the Elevator,69.8%,Medium,0.08515780834030685, https://leetcode.com/problems/last-person-to-fit-in-the-elevator
1212,Team Scores in Football Tournament,55.8%,Medium,0.07862594238342736, https://leetcode.com/problems/team-scores-in-football-tournament
443,String Compression,41.3%,Easy,0.052333720049023605, https://leetcode.com/problems/string-compression
85,Maximal Rectangle,37.7%,Hard,0.050135812424355455, https://leetcode.com/problems/maximal-rectangle
412,Fizz Buzz,62.3%,Easy,0.027152525030955416, https://leetcode.com/problems/fizz-buzz
718,Maximum Length of Repeated Subarray,49.4%,Medium,0.02699219201435624, https://leetcode.com/problems/maximum-length-of-repeated-subarray
5,Longest Palindromic Substring,29.5%,Medium,0.019425420619316486, https://leetcode.com/problems/longest-palindromic-substring
184,Department Highest Salary,36.7%,Medium,0.018018505502678313, https://leetcode.com/problems/department-highest-salary
125,Valid Palindrome,36.7%,Easy,0.015106027431013205, https://leetcode.com/problems/valid-palindrome
69,Sqrt(x),33.9%,Easy,0.010949014489670414, https://leetcode.com/problems/sqrtx
56,Merge Intervals,39.3%,Medium,0.0074386655924217485, https://leetcode.com/problems/merge-intervals
41,First Missing Positive,32.0%,Hard,0.006163347707668678, https://leetcode.com/problems/first-missing-positive
53,Maximum Subarray,46.5%,Easy,0.0020745819379855658, https://leetcode.com/problems/maximum-subarray
210,Course Schedule II,40.7%,Medium,0.0018850146957713153, https://leetcode.com/problems/course-schedule-ii
1 840 ID Magic Squares In Grid Title 37.3% Acceptance Easy Difficulty 0.4449565940664958 Frequency https://leetcode.com/problems/magic-squares-in-grid Leetcode Question Link
2 811 840 Subdomain Visit Count Magic Squares In Grid 69.9% 37.3% Easy Easy 0.28185115214098777 0.4449565940664958 https://leetcode.com/problems/subdomain-visit-count https://leetcode.com/problems/magic-squares-in-grid
3 1189 811 Maximum Number of Balloons Subdomain Visit Count 61.2% 69.9% Easy Easy 0.11874571021547974 0.28185115214098777 https://leetcode.com/problems/maximum-number-of-balloons https://leetcode.com/problems/subdomain-visit-count
4 759 1189 Employee Free Time Maximum Number of Balloons 66.3% 61.2% Hard Easy 0.10143824284548837 0.11874571021547974 https://leetcode.com/problems/employee-free-time https://leetcode.com/problems/maximum-number-of-balloons
5 1204 759 Last Person to Fit in the Elevator Employee Free Time 69.8% 66.3% Medium Hard 0.08515780834030685 0.10143824284548837 https://leetcode.com/problems/last-person-to-fit-in-the-elevator https://leetcode.com/problems/employee-free-time
6 1212 1204 Team Scores in Football Tournament Last Person to Fit in the Elevator 55.8% 69.8% Medium Medium 0.07862594238342736 0.08515780834030685 https://leetcode.com/problems/team-scores-in-football-tournament https://leetcode.com/problems/last-person-to-fit-in-the-elevator
7 443 1212 String Compression Team Scores in Football Tournament 41.3% 55.8% Easy Medium 0.052333720049023605 0.07862594238342736 https://leetcode.com/problems/string-compression https://leetcode.com/problems/team-scores-in-football-tournament
8 85 443 Maximal Rectangle String Compression 37.7% 41.3% Hard Easy 0.050135812424355455 0.052333720049023605 https://leetcode.com/problems/maximal-rectangle https://leetcode.com/problems/string-compression
9 412 85 Fizz Buzz Maximal Rectangle 62.3% 37.7% Easy Hard 0.027152525030955416 0.050135812424355455 https://leetcode.com/problems/fizz-buzz https://leetcode.com/problems/maximal-rectangle
10 718 412 Maximum Length of Repeated Subarray Fizz Buzz 49.4% 62.3% Medium Easy 0.02699219201435624 0.027152525030955416 https://leetcode.com/problems/maximum-length-of-repeated-subarray https://leetcode.com/problems/fizz-buzz
11 5 718 Longest Palindromic Substring Maximum Length of Repeated Subarray 29.5% 49.4% Medium Medium 0.019425420619316486 0.02699219201435624 https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/maximum-length-of-repeated-subarray
12 184 5 Department Highest Salary Longest Palindromic Substring 36.7% 29.5% Medium Medium 0.018018505502678313 0.019425420619316486 https://leetcode.com/problems/department-highest-salary https://leetcode.com/problems/longest-palindromic-substring
13 125 184 Valid Palindrome Department Highest Salary 36.7% 36.7% Easy Medium 0.015106027431013205 0.018018505502678313 https://leetcode.com/problems/valid-palindrome https://leetcode.com/problems/department-highest-salary
14 69 125 Sqrt(x) Valid Palindrome 33.9% 36.7% Easy Easy 0.010949014489670414 0.015106027431013205 https://leetcode.com/problems/sqrtx https://leetcode.com/problems/valid-palindrome
15 56 69 Merge Intervals Sqrt(x) 39.3% 33.9% Medium Easy 0.0074386655924217485 0.010949014489670414 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/sqrtx
16 41 56 First Missing Positive Merge Intervals 32.0% 39.3% Hard Medium 0.006163347707668678 0.0074386655924217485 https://leetcode.com/problems/first-missing-positive https://leetcode.com/problems/merge-intervals
17 53 41 Maximum Subarray First Missing Positive 46.5% 32.0% Easy Hard 0.0020745819379855658 0.006163347707668678 https://leetcode.com/problems/maximum-subarray https://leetcode.com/problems/first-missing-positive
18 210 53 Course Schedule II Maximum Subarray 40.7% 46.5% Medium Easy 0.0018850146957713153 0.0020745819379855658 https://leetcode.com/problems/course-schedule-ii https://leetcode.com/problems/maximum-subarray
19 210 Course Schedule II 40.7% Medium 0.0018850146957713153 https://leetcode.com/problems/course-schedule-ii