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,20 +1,21 @@
695,Max Area of Island,62.7%,Medium,0.7679307328544888, https://leetcode.com/problems/max-area-of-island
759,Employee Free Time,66.3%,Hard,0.754042350785198, https://leetcode.com/problems/employee-free-time
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.43160716401293453, https://leetcode.com/problems/design-twitter
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.19278242868174433, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
1174,Immediate Food Delivery II,58.5%,Medium,0.12555653398976382, https://leetcode.com/problems/immediate-food-delivery-ii
210,Course Schedule II,40.7%,Medium,0.10207384808971935, https://leetcode.com/problems/course-schedule-ii
227,Basic Calculator II,36.9%,Medium,0.07508779675444797, https://leetcode.com/problems/basic-calculator-ii
1173,Immediate Food Delivery I,80.4%,Easy,0.06592172080482424, https://leetcode.com/problems/immediate-food-delivery-i
528,Random Pick with Weight,43.9%,Medium,0.03306693626657339, https://leetcode.com/problems/random-pick-with-weight
348,Design Tic-Tac-Toe,54.3%,Medium,0.024214258120594613, https://leetcode.com/problems/design-tic-tac-toe
37,Sudoku Solver,43.6%,Hard,0.01821543989134118, https://leetcode.com/problems/sudoku-solver
56,Merge Intervals,39.3%,Medium,0.013819532422258866, https://leetcode.com/problems/merge-intervals
269,Alien Dictionary,33.3%,Hard,0.012730916694039954, https://leetcode.com/problems/alien-dictionary
36,Valid Sudoku,48.7%,Medium,0.007258242715805398, https://leetcode.com/problems/valid-sudoku
200,Number of Islands,46.8%,Medium,0.006490251382779317, https://leetcode.com/problems/number-of-islands
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
695,Max Area of Island,62.7%,Medium,0.7679307328544888, https://leetcode.com/problems/max-area-of-island
759,Employee Free Time,66.3%,Hard,0.754042350785198, https://leetcode.com/problems/employee-free-time
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.43160716401293453, https://leetcode.com/problems/design-twitter
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.19278242868174433, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
1174,Immediate Food Delivery II,58.5%,Medium,0.12555653398976382, https://leetcode.com/problems/immediate-food-delivery-ii
210,Course Schedule II,40.7%,Medium,0.10207384808971935, https://leetcode.com/problems/course-schedule-ii
227,Basic Calculator II,36.9%,Medium,0.07508779675444797, https://leetcode.com/problems/basic-calculator-ii
1173,Immediate Food Delivery I,80.4%,Easy,0.06592172080482424, https://leetcode.com/problems/immediate-food-delivery-i
528,Random Pick with Weight,43.9%,Medium,0.03306693626657339, https://leetcode.com/problems/random-pick-with-weight
348,Design Tic-Tac-Toe,54.3%,Medium,0.024214258120594613, https://leetcode.com/problems/design-tic-tac-toe
37,Sudoku Solver,43.6%,Hard,0.01821543989134118, https://leetcode.com/problems/sudoku-solver
56,Merge Intervals,39.3%,Medium,0.013819532422258866, https://leetcode.com/problems/merge-intervals
269,Alien Dictionary,33.3%,Hard,0.012730916694039954, https://leetcode.com/problems/alien-dictionary
36,Valid Sudoku,48.7%,Medium,0.007258242715805398, https://leetcode.com/problems/valid-sudoku
200,Number of Islands,46.8%,Medium,0.006490251382779317, https://leetcode.com/problems/number-of-islands
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
1 695 ID Max Area of Island Title 62.7% Acceptance Medium Difficulty 0.7679307328544888 Frequency https://leetcode.com/problems/max-area-of-island Leetcode Question Link
2 759 695 Employee Free Time Max Area of Island 66.3% 62.7% Hard Medium 0.754042350785198 0.7679307328544888 https://leetcode.com/problems/employee-free-time https://leetcode.com/problems/max-area-of-island
3 1229 759 Meeting Scheduler Employee Free Time 52.7% 66.3% Medium Hard 0.5152176154540078 0.754042350785198 https://leetcode.com/problems/meeting-scheduler https://leetcode.com/problems/employee-free-time
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.43160716401293453 0.4639892692240469 https://leetcode.com/problems/design-twitter https://leetcode.com/problems/count-all-valid-pickup-and-delivery-options
6 121 355 Best Time to Buy and Sell Stock Design Twitter 50.5% 30.3% Easy Medium 0.19278242868174433 0.43160716401293453 https://leetcode.com/problems/best-time-to-buy-and-sell-stock https://leetcode.com/problems/design-twitter
7 1174 121 Immediate Food Delivery II Best Time to Buy and Sell Stock 58.5% 50.5% Medium Easy 0.12555653398976382 0.19278242868174433 https://leetcode.com/problems/immediate-food-delivery-ii https://leetcode.com/problems/best-time-to-buy-and-sell-stock
8 210 1174 Course Schedule II Immediate Food Delivery II 40.7% 58.5% Medium Medium 0.10207384808971935 0.12555653398976382 https://leetcode.com/problems/course-schedule-ii https://leetcode.com/problems/immediate-food-delivery-ii
9 227 210 Basic Calculator II Course Schedule II 36.9% 40.7% Medium Medium 0.07508779675444797 0.10207384808971935 https://leetcode.com/problems/basic-calculator-ii https://leetcode.com/problems/course-schedule-ii
10 1173 227 Immediate Food Delivery I Basic Calculator II 80.4% 36.9% Easy Medium 0.06592172080482424 0.07508779675444797 https://leetcode.com/problems/immediate-food-delivery-i https://leetcode.com/problems/basic-calculator-ii
11 528 1173 Random Pick with Weight Immediate Food Delivery I 43.9% 80.4% Medium Easy 0.03306693626657339 0.06592172080482424 https://leetcode.com/problems/random-pick-with-weight https://leetcode.com/problems/immediate-food-delivery-i
12 348 528 Design Tic-Tac-Toe Random Pick with Weight 54.3% 43.9% Medium Medium 0.024214258120594613 0.03306693626657339 https://leetcode.com/problems/design-tic-tac-toe https://leetcode.com/problems/random-pick-with-weight
13 37 348 Sudoku Solver Design Tic-Tac-Toe 43.6% 54.3% Hard Medium 0.01821543989134118 0.024214258120594613 https://leetcode.com/problems/sudoku-solver https://leetcode.com/problems/design-tic-tac-toe
14 56 37 Merge Intervals Sudoku Solver 39.3% 43.6% Medium Hard 0.013819532422258866 0.01821543989134118 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/sudoku-solver
15 269 56 Alien Dictionary Merge Intervals 33.3% 39.3% Hard Medium 0.012730916694039954 0.013819532422258866 https://leetcode.com/problems/alien-dictionary https://leetcode.com/problems/merge-intervals
16 36 269 Valid Sudoku Alien Dictionary 48.7% 33.3% Medium Hard 0.007258242715805398 0.012730916694039954 https://leetcode.com/problems/valid-sudoku https://leetcode.com/problems/alien-dictionary
17 200 36 Number of Islands Valid Sudoku 46.8% 48.7% Medium Medium 0.006490251382779317 0.007258242715805398 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/valid-sudoku
18 15 200 3Sum Number of Islands 26.8% 46.8% Medium Medium 0.004940992758742591 0.006490251382779317 https://leetcode.com/problems/3sum https://leetcode.com/problems/number-of-islands
19 146 15 LRU Cache 3Sum 33.2% 26.8% Medium Medium 0.004600353139061353 0.004940992758742591 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/3sum
20 20 146 Valid Parentheses LRU Cache 39.0% 33.2% Easy Medium 0.0023005704055949323 0.004600353139061353 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/lru-cache
21 20 Valid Parentheses 39.0% Easy 0.0023005704055949323 https://leetcode.com/problems/valid-parentheses