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,22 +1,23 @@
811,Subdomain Visit Count,69.9%,Easy,2.447028162023433, https://leetcode.com/problems/subdomain-visit-count
770,Basic Calculator IV,48.1%,Hard,1.9937403768488644, https://leetcode.com/problems/basic-calculator-iv
829,Consecutive Numbers Sum,37.5%,Hard,1.5906860988778346, https://leetcode.com/problems/consecutive-numbers-sum
224,Basic Calculator,36.8%,Hard,1.1373983137032662, https://leetcode.com/problems/basic-calculator
1163,Last Substring in Lexicographical Order,33.9%,Hard,0.7261919753374027, https://leetcode.com/problems/last-substring-in-lexicographical-order
1297,Maximum Number of Occurrences of a Substring,47.3%,Medium,0.40882645581086924, https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
1328,Break a Palindrome,43.3%,Medium,0.21795507637539235, https://leetcode.com/problems/break-a-palindrome
1248,Count Number of Nice Subarrays,56.4%,Medium,0.17228309044709728, https://leetcode.com/problems/count-number-of-nice-subarrays
1290,Convert Binary Number in a Linked List to Integer,80.4%,Easy,0.0913181585347874, https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer
146,LRU Cache,33.2%,Medium,0.07118067822062889, https://leetcode.com/problems/lru-cache
212,Word Search II,34.9%,Hard,0.05999879858378973, https://leetcode.com/problems/word-search-ii
239,Sliding Window Maximum,43.0%,Hard,0.0483746857022364, https://leetcode.com/problems/sliding-window-maximum
647,Palindromic Substrings,60.6%,Medium,0.040968350772541844, https://leetcode.com/problems/palindromic-substrings
17,Letter Combinations of a Phone Number,46.8%,Medium,0.03893646375009422, https://leetcode.com/problems/letter-combinations-of-a-phone-number
37,Sudoku Solver,43.6%,Hard,0.01821543989134118, https://leetcode.com/problems/sudoku-solver
36,Valid Sudoku,48.7%,Medium,0.01625758350956095, https://leetcode.com/problems/valid-sudoku
5,Longest Palindromic Substring,29.5%,Medium,0.009086325220960808, https://leetcode.com/problems/longest-palindromic-substring
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
1,Two Sum,45.6%,Easy,0.0008206138651873125, https://leetcode.com/problems/two-sum
1282,Group the People Given the Group Size They Belong To,83.9%,Medium,0, https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to
1280,Students and Examinations,72.2%,Easy,0, https://leetcode.com/problems/students-and-examinations
1364,Number of Trusted Contacts of a Customer,75.5%,Medium,0, https://leetcode.com/problems/number-of-trusted-contacts-of-a-customer
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
811,Subdomain Visit Count,69.9%,Easy,2.447028162023433, https://leetcode.com/problems/subdomain-visit-count
770,Basic Calculator IV,48.1%,Hard,1.9937403768488644, https://leetcode.com/problems/basic-calculator-iv
829,Consecutive Numbers Sum,37.5%,Hard,1.5906860988778346, https://leetcode.com/problems/consecutive-numbers-sum
224,Basic Calculator,36.8%,Hard,1.1373983137032662, https://leetcode.com/problems/basic-calculator
1163,Last Substring in Lexicographical Order,33.9%,Hard,0.7261919753374027, https://leetcode.com/problems/last-substring-in-lexicographical-order
1297,Maximum Number of Occurrences of a Substring,47.3%,Medium,0.40882645581086924, https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
1328,Break a Palindrome,43.3%,Medium,0.21795507637539235, https://leetcode.com/problems/break-a-palindrome
1248,Count Number of Nice Subarrays,56.4%,Medium,0.17228309044709728, https://leetcode.com/problems/count-number-of-nice-subarrays
1290,Convert Binary Number in a Linked List to Integer,80.4%,Easy,0.0913181585347874, https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer
146,LRU Cache,33.2%,Medium,0.07118067822062889, https://leetcode.com/problems/lru-cache
212,Word Search II,34.9%,Hard,0.05999879858378973, https://leetcode.com/problems/word-search-ii
239,Sliding Window Maximum,43.0%,Hard,0.0483746857022364, https://leetcode.com/problems/sliding-window-maximum
647,Palindromic Substrings,60.6%,Medium,0.040968350772541844, https://leetcode.com/problems/palindromic-substrings
17,Letter Combinations of a Phone Number,46.8%,Medium,0.03893646375009422, https://leetcode.com/problems/letter-combinations-of-a-phone-number
37,Sudoku Solver,43.6%,Hard,0.01821543989134118, https://leetcode.com/problems/sudoku-solver
36,Valid Sudoku,48.7%,Medium,0.01625758350956095, https://leetcode.com/problems/valid-sudoku
5,Longest Palindromic Substring,29.5%,Medium,0.009086325220960808, https://leetcode.com/problems/longest-palindromic-substring
200,Number of Islands,46.8%,Medium,0.0028897578265903614, https://leetcode.com/problems/number-of-islands
1,Two Sum,45.6%,Easy,0.0008206138651873125, https://leetcode.com/problems/two-sum
1282,Group the People Given the Group Size They Belong To,83.9%,Medium,0, https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to
1280,Students and Examinations,72.2%,Easy,0, https://leetcode.com/problems/students-and-examinations
1364,Number of Trusted Contacts of a Customer,75.5%,Medium,0, https://leetcode.com/problems/number-of-trusted-contacts-of-a-customer
1 811 ID Subdomain Visit Count Title 69.9% Acceptance Easy Difficulty 2.447028162023433 Frequency https://leetcode.com/problems/subdomain-visit-count Leetcode Question Link
2 770 811 Basic Calculator IV Subdomain Visit Count 48.1% 69.9% Hard Easy 1.9937403768488644 2.447028162023433 https://leetcode.com/problems/basic-calculator-iv https://leetcode.com/problems/subdomain-visit-count
3 829 770 Consecutive Numbers Sum Basic Calculator IV 37.5% 48.1% Hard Hard 1.5906860988778346 1.9937403768488644 https://leetcode.com/problems/consecutive-numbers-sum https://leetcode.com/problems/basic-calculator-iv
4 224 829 Basic Calculator Consecutive Numbers Sum 36.8% 37.5% Hard Hard 1.1373983137032662 1.5906860988778346 https://leetcode.com/problems/basic-calculator https://leetcode.com/problems/consecutive-numbers-sum
5 1163 224 Last Substring in Lexicographical Order Basic Calculator 33.9% 36.8% Hard Hard 0.7261919753374027 1.1373983137032662 https://leetcode.com/problems/last-substring-in-lexicographical-order https://leetcode.com/problems/basic-calculator
6 1297 1163 Maximum Number of Occurrences of a Substring Last Substring in Lexicographical Order 47.3% 33.9% Medium Hard 0.40882645581086924 0.7261919753374027 https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring https://leetcode.com/problems/last-substring-in-lexicographical-order
7 1328 1297 Break a Palindrome Maximum Number of Occurrences of a Substring 43.3% 47.3% Medium Medium 0.21795507637539235 0.40882645581086924 https://leetcode.com/problems/break-a-palindrome https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
8 1248 1328 Count Number of Nice Subarrays Break a Palindrome 56.4% 43.3% Medium Medium 0.17228309044709728 0.21795507637539235 https://leetcode.com/problems/count-number-of-nice-subarrays https://leetcode.com/problems/break-a-palindrome
9 1290 1248 Convert Binary Number in a Linked List to Integer Count Number of Nice Subarrays 80.4% 56.4% Easy Medium 0.0913181585347874 0.17228309044709728 https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer https://leetcode.com/problems/count-number-of-nice-subarrays
10 146 1290 LRU Cache Convert Binary Number in a Linked List to Integer 33.2% 80.4% Medium Easy 0.07118067822062889 0.0913181585347874 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer
11 212 146 Word Search II LRU Cache 34.9% 33.2% Hard Medium 0.05999879858378973 0.07118067822062889 https://leetcode.com/problems/word-search-ii https://leetcode.com/problems/lru-cache
12 239 212 Sliding Window Maximum Word Search II 43.0% 34.9% Hard Hard 0.0483746857022364 0.05999879858378973 https://leetcode.com/problems/sliding-window-maximum https://leetcode.com/problems/word-search-ii
13 647 239 Palindromic Substrings Sliding Window Maximum 60.6% 43.0% Medium Hard 0.040968350772541844 0.0483746857022364 https://leetcode.com/problems/palindromic-substrings https://leetcode.com/problems/sliding-window-maximum
14 17 647 Letter Combinations of a Phone Number Palindromic Substrings 46.8% 60.6% Medium Medium 0.03893646375009422 0.040968350772541844 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/palindromic-substrings
15 37 17 Sudoku Solver Letter Combinations of a Phone Number 43.6% 46.8% Hard Medium 0.01821543989134118 0.03893646375009422 https://leetcode.com/problems/sudoku-solver https://leetcode.com/problems/letter-combinations-of-a-phone-number
16 36 37 Valid Sudoku Sudoku Solver 48.7% 43.6% Medium Hard 0.01625758350956095 0.01821543989134118 https://leetcode.com/problems/valid-sudoku https://leetcode.com/problems/sudoku-solver
17 5 36 Longest Palindromic Substring Valid Sudoku 29.5% 48.7% Medium Medium 0.009086325220960808 0.01625758350956095 https://leetcode.com/problems/longest-palindromic-substring https://leetcode.com/problems/valid-sudoku
18 200 5 Number of Islands Longest Palindromic Substring 46.8% 29.5% Medium Medium 0.0028897578265903614 0.009086325220960808 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/longest-palindromic-substring
19 1 200 Two Sum Number of Islands 45.6% 46.8% Easy Medium 0.0008206138651873125 0.0028897578265903614 https://leetcode.com/problems/two-sum https://leetcode.com/problems/number-of-islands
20 1282 1 Group the People Given the Group Size They Belong To Two Sum 83.9% 45.6% Medium Easy 0 0.0008206138651873125 https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to https://leetcode.com/problems/two-sum
21 1280 1282 Students and Examinations Group the People Given the Group Size They Belong To 72.2% 83.9% Easy Medium 0 0 https://leetcode.com/problems/students-and-examinations https://leetcode.com/problems/group-the-people-given-the-group-size-they-belong-to
22 1364 1280 Number of Trusted Contacts of a Customer Students and Examinations 75.5% 72.2% Medium Easy 0 0 https://leetcode.com/problems/number-of-trusted-contacts-of-a-customer https://leetcode.com/problems/students-and-examinations
23 1364 Number of Trusted Contacts of a Customer 75.5% Medium 0 https://leetcode.com/problems/number-of-trusted-contacts-of-a-customer