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