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,11 +1,12 @@
593,Valid Square,43.1%,Medium,0.8850660255420153, https://leetcode.com/problems/valid-square
647,Palindromic Substrings,60.6%,Medium,0.5969293308834104, https://leetcode.com/problems/palindromic-substrings
203,Remove Linked List Elements,38.6%,Easy,0.30879263622480546, https://leetcode.com/problems/remove-linked-list-elements
730,Count Different Palindromic Subsequences,41.8%,Hard,0.26866680633829343, https://leetcode.com/problems/count-different-palindromic-subsequences
716,Max Stack,42.6%,Easy,0.04103139667786253, https://leetcode.com/problems/max-stack
75,Sort Colors,47.3%,Medium,0.02953900967923939, https://leetcode.com/problems/sort-colors
155,Min Stack,44.5%,Easy,0.010200700488022775, https://leetcode.com/problems/min-stack
380,Insert Delete GetRandom O(1),47.5%,Medium,0.00934149716911291, https://leetcode.com/problems/insert-delete-getrandom-o1
202,Happy Number,50.4%,Easy,0.0059889383976452016, https://leetcode.com/problems/happy-number
167,Two Sum II - Input array is sorted,54.1%,Easy,0.005280540323033287, https://leetcode.com/problems/two-sum-ii-input-array-is-sorted
5,Longest Palindromic Substring,29.5%,Medium,0.0048918458243339055, https://leetcode.com/problems/longest-palindromic-substring
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
593,Valid Square,43.1%,Medium,0.8850660255420153, https://leetcode.com/problems/valid-square
647,Palindromic Substrings,60.6%,Medium,0.5969293308834104, https://leetcode.com/problems/palindromic-substrings
203,Remove Linked List Elements,38.6%,Easy,0.30879263622480546, https://leetcode.com/problems/remove-linked-list-elements
730,Count Different Palindromic Subsequences,41.8%,Hard,0.26866680633829343, https://leetcode.com/problems/count-different-palindromic-subsequences
716,Max Stack,42.6%,Easy,0.04103139667786253, https://leetcode.com/problems/max-stack
75,Sort Colors,47.3%,Medium,0.02953900967923939, https://leetcode.com/problems/sort-colors
155,Min Stack,44.5%,Easy,0.010200700488022775, https://leetcode.com/problems/min-stack
380,Insert Delete GetRandom O(1),47.5%,Medium,0.00934149716911291, https://leetcode.com/problems/insert-delete-getrandom-o1
202,Happy Number,50.4%,Easy,0.0059889383976452016, https://leetcode.com/problems/happy-number
167,Two Sum II - Input array is sorted,54.1%,Easy,0.005280540323033287, https://leetcode.com/problems/two-sum-ii-input-array-is-sorted
5,Longest Palindromic Substring,29.5%,Medium,0.0048918458243339055, https://leetcode.com/problems/longest-palindromic-substring
1 593 ID Valid Square Title 43.1% Acceptance Medium Difficulty 0.8850660255420153 Frequency https://leetcode.com/problems/valid-square Leetcode Question Link
2 647 593 Palindromic Substrings Valid Square 60.6% 43.1% Medium Medium 0.5969293308834104 0.8850660255420153 https://leetcode.com/problems/palindromic-substrings https://leetcode.com/problems/valid-square
3 203 647 Remove Linked List Elements Palindromic Substrings 38.6% 60.6% Easy Medium 0.30879263622480546 0.5969293308834104 https://leetcode.com/problems/remove-linked-list-elements https://leetcode.com/problems/palindromic-substrings
4 730 203 Count Different Palindromic Subsequences Remove Linked List Elements 41.8% 38.6% Hard Easy 0.26866680633829343 0.30879263622480546 https://leetcode.com/problems/count-different-palindromic-subsequences https://leetcode.com/problems/remove-linked-list-elements
5 716 730 Max Stack Count Different Palindromic Subsequences 42.6% 41.8% Easy Hard 0.04103139667786253 0.26866680633829343 https://leetcode.com/problems/max-stack https://leetcode.com/problems/count-different-palindromic-subsequences
6 75 716 Sort Colors Max Stack 47.3% 42.6% Medium Easy 0.02953900967923939 0.04103139667786253 https://leetcode.com/problems/sort-colors https://leetcode.com/problems/max-stack
7 155 75 Min Stack Sort Colors 44.5% 47.3% Easy Medium 0.010200700488022775 0.02953900967923939 https://leetcode.com/problems/min-stack https://leetcode.com/problems/sort-colors
8 380 155 Insert Delete GetRandom O(1) Min Stack 47.5% 44.5% Medium Easy 0.00934149716911291 0.010200700488022775 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/min-stack
9 202 380 Happy Number Insert Delete GetRandom O(1) 50.4% 47.5% Easy Medium 0.0059889383976452016 0.00934149716911291 https://leetcode.com/problems/happy-number https://leetcode.com/problems/insert-delete-getrandom-o1
10 167 202 Two Sum II - Input array is sorted Happy Number 54.1% 50.4% Easy Easy 0.005280540323033287 0.0059889383976452016 https://leetcode.com/problems/two-sum-ii-input-array-is-sorted https://leetcode.com/problems/happy-number
11 5 167 Longest Palindromic Substring Two Sum II - Input array is sorted 29.5% 54.1% Medium Easy 0.0048918458243339055 0.005280540323033287 https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/two-sum-ii-input-array-is-sorted
12 5 Longest Palindromic Substring 29.5% Medium 0.0048918458243339055 https://leetcode.com/problems/longest-palindromic-substring