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,15 +1,16 @@
759,Employee Free Time,66.3%,Hard,0.8067517126995383, https://leetcode.com/problems/employee-free-time
695,Max Area of Island,62.7%,Medium,0.7079785078050851, https://leetcode.com/problems/max-area-of-island
1229,Meeting Scheduler,52.7%,Medium,0.5152176154540078, https://leetcode.com/problems/meeting-scheduler
1359,Count All Valid Pickup and Delivery Options,57.9%,Hard,0.4639892692240469, https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
355,Design Twitter,30.3%,Medium,0.3183174263408411, https://leetcode.com/problems/design-twitter
1174,Immediate Food Delivery II,58.5%,Medium,0.12555653398976382, https://leetcode.com/problems/immediate-food-delivery-ii
1173,Immediate Food Delivery I,80.4%,Easy,0.06592172080482424, https://leetcode.com/problems/immediate-food-delivery-i
37,Sudoku Solver,43.6%,Hard,0.01821543989134118, https://leetcode.com/problems/sudoku-solver
210,Course Schedule II,40.7%,Medium,0.01704828902223426, https://leetcode.com/problems/course-schedule-ii
56,Merge Intervals,39.3%,Medium,0.013819532422258866, https://leetcode.com/problems/merge-intervals
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
36,Valid Sudoku,48.7%,Medium,0.007258242715805398, https://leetcode.com/problems/valid-sudoku
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0047725193990346675, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
759,Employee Free Time,66.3%,Hard,0.8067517126995383, https://leetcode.com/problems/employee-free-time
695,Max Area of Island,62.7%,Medium,0.7079785078050851, https://leetcode.com/problems/max-area-of-island
1229,Meeting Scheduler,52.7%,Medium,0.5152176154540078, https://leetcode.com/problems/meeting-scheduler
1359,Count All Valid Pickup and Delivery Options,57.9%,Hard,0.4639892692240469, https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
355,Design Twitter,30.3%,Medium,0.3183174263408411, https://leetcode.com/problems/design-twitter
1174,Immediate Food Delivery II,58.5%,Medium,0.12555653398976382, https://leetcode.com/problems/immediate-food-delivery-ii
1173,Immediate Food Delivery I,80.4%,Easy,0.06592172080482424, https://leetcode.com/problems/immediate-food-delivery-i
37,Sudoku Solver,43.6%,Hard,0.01821543989134118, https://leetcode.com/problems/sudoku-solver
210,Course Schedule II,40.7%,Medium,0.01704828902223426, https://leetcode.com/problems/course-schedule-ii
56,Merge Intervals,39.3%,Medium,0.013819532422258866, https://leetcode.com/problems/merge-intervals
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
36,Valid Sudoku,48.7%,Medium,0.007258242715805398, https://leetcode.com/problems/valid-sudoku
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0047725193990346675, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
1 759 ID Employee Free Time Title 66.3% Acceptance Hard Difficulty 0.8067517126995383 Frequency https://leetcode.com/problems/employee-free-time Leetcode Question Link
2 695 759 Max Area of Island Employee Free Time 62.7% 66.3% Medium Hard 0.7079785078050851 0.8067517126995383 https://leetcode.com/problems/max-area-of-island https://leetcode.com/problems/employee-free-time
3 1229 695 Meeting Scheduler Max Area of Island 52.7% 62.7% Medium Medium 0.5152176154540078 0.7079785078050851 https://leetcode.com/problems/meeting-scheduler https://leetcode.com/problems/max-area-of-island
4 1359 1229 Count All Valid Pickup and Delivery Options Meeting Scheduler 57.9% 52.7% Hard Medium 0.4639892692240469 0.5152176154540078 https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options https://leetcode.com/problems/meeting-scheduler
5 355 1359 Design Twitter Count All Valid Pickup and Delivery Options 30.3% 57.9% Medium Hard 0.3183174263408411 0.4639892692240469 https://leetcode.com/problems/design-twitter https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
6 1174 355 Immediate Food Delivery II Design Twitter 58.5% 30.3% Medium Medium 0.12555653398976382 0.3183174263408411 https://leetcode.com/problems/immediate-food-delivery-ii https://leetcode.com/problems/design-twitter
7 1173 1174 Immediate Food Delivery I Immediate Food Delivery II 80.4% 58.5% Easy Medium 0.06592172080482424 0.12555653398976382 https://leetcode.com/problems/immediate-food-delivery-i https://leetcode.com/problems/immediate-food-delivery-ii
8 37 1173 Sudoku Solver Immediate Food Delivery I 43.6% 80.4% Hard Easy 0.01821543989134118 0.06592172080482424 https://leetcode.com/problems/sudoku-solver https://leetcode.com/problems/immediate-food-delivery-i
9 210 37 Course Schedule II Sudoku Solver 40.7% 43.6% Medium Hard 0.01704828902223426 0.01821543989134118 https://leetcode.com/problems/course-schedule-ii https://leetcode.com/problems/sudoku-solver
10 56 210 Merge Intervals Course Schedule II 39.3% 40.7% Medium Medium 0.013819532422258866 0.01704828902223426 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/course-schedule-ii
11 227 56 Basic Calculator II Merge Intervals 36.9% 39.3% Medium Medium 0.01239941490503826 0.013819532422258866 https://leetcode.com/problems/basic-calculator-ii https://leetcode.com/problems/merge-intervals
12 36 227 Valid Sudoku Basic Calculator II 48.7% 36.9% Medium Medium 0.007258242715805398 0.01239941490503826 https://leetcode.com/problems/valid-sudoku https://leetcode.com/problems/basic-calculator-ii
13 15 36 3Sum Valid Sudoku 26.8% 48.7% Medium Medium 0.004940992758742591 0.007258242715805398 https://leetcode.com/problems/3sum https://leetcode.com/problems/valid-sudoku
14 121 15 Best Time to Buy and Sell Stock 3Sum 50.5% 26.8% Easy Medium 0.0047725193990346675 0.004940992758742591 https://leetcode.com/problems/best-time-to-buy-and-sell-stock https://leetcode.com/problems/3sum
15 146 121 LRU Cache Best Time to Buy and Sell Stock 33.2% 50.5% Medium Easy 0.004600353139061353 0.0047725193990346675 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/best-time-to-buy-and-sell-stock
16 146 LRU Cache 33.2% Medium 0.004600353139061353 https://leetcode.com/problems/lru-cache