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,17 +1,18 @@
228,Summary Ranges,39.5%,Medium,2.379243547602478, https://leetcode.com/problems/summary-ranges
814,Binary Tree Pruning,74.5%,Medium,1.714403093040326, https://leetcode.com/problems/binary-tree-pruning
328,Odd Even Linked List,55.7%,Medium,1.514446116622737, https://leetcode.com/problems/odd-even-linked-list
138,Copy List with Random Pointer,36.4%,Medium,1.3877294433016032, https://leetcode.com/problems/copy-list-with-random-pointer
290,Word Pattern,37.0%,Easy,1.3013067642290357, https://leetcode.com/problems/word-pattern
2,Add Two Numbers,33.9%,Medium,1.2542105308123643, https://leetcode.com/problems/add-two-numbers
322,Coin Change,35.5%,Medium,1.0832857985041888, https://leetcode.com/problems/coin-change
412,Fizz Buzz,62.3%,Easy,0.41844534394203714, https://leetcode.com/problems/fizz-buzz
1071,Greatest Common Divisor of Strings,52.9%,Easy,0.4175376893424336, https://leetcode.com/problems/greatest-common-divisor-of-strings
273,Integer to English Words,27.1%,Hard,0.26532833604818473, https://leetcode.com/problems/integer-to-english-words
204,Count Primes,31.5%,Easy,0.1633347782917643, https://leetcode.com/problems/count-primes
98,Validate Binary Search Tree,27.8%,Medium,0.07111326337575957, https://leetcode.com/problems/validate-binary-search-tree
53,Maximum Subarray,46.5%,Easy,0.052816160704876255, https://leetcode.com/problems/maximum-subarray
21,Merge Two Sorted Lists,53.5%,Easy,0.014012111332134735, https://leetcode.com/problems/merge-two-sorted-lists
66,Plus One,43.0%,Easy,0.007324847595025828, https://leetcode.com/problems/plus-one
203,Remove Linked List Elements,38.6%,Easy,0.006479067005887776, https://leetcode.com/problems/remove-linked-list-elements
1390,Four Divisors,38.1%,Medium,0, https://leetcode.com/problems/four-divisors
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
228,Summary Ranges,39.5%,Medium,2.379243547602478, https://leetcode.com/problems/summary-ranges
814,Binary Tree Pruning,74.5%,Medium,1.714403093040326, https://leetcode.com/problems/binary-tree-pruning
328,Odd Even Linked List,55.7%,Medium,1.514446116622737, https://leetcode.com/problems/odd-even-linked-list
138,Copy List with Random Pointer,36.4%,Medium,1.3877294433016032, https://leetcode.com/problems/copy-list-with-random-pointer
290,Word Pattern,37.0%,Easy,1.3013067642290357, https://leetcode.com/problems/word-pattern
2,Add Two Numbers,33.9%,Medium,1.2542105308123643, https://leetcode.com/problems/add-two-numbers
322,Coin Change,35.5%,Medium,1.0832857985041888, https://leetcode.com/problems/coin-change
412,Fizz Buzz,62.3%,Easy,0.41844534394203714, https://leetcode.com/problems/fizz-buzz
1071,Greatest Common Divisor of Strings,52.9%,Easy,0.4175376893424336, https://leetcode.com/problems/greatest-common-divisor-of-strings
273,Integer to English Words,27.1%,Hard,0.26532833604818473, https://leetcode.com/problems/integer-to-english-words
204,Count Primes,31.5%,Easy,0.1633347782917643, https://leetcode.com/problems/count-primes
98,Validate Binary Search Tree,27.8%,Medium,0.07111326337575957, https://leetcode.com/problems/validate-binary-search-tree
53,Maximum Subarray,46.5%,Easy,0.052816160704876255, https://leetcode.com/problems/maximum-subarray
21,Merge Two Sorted Lists,53.5%,Easy,0.014012111332134735, https://leetcode.com/problems/merge-two-sorted-lists
66,Plus One,43.0%,Easy,0.007324847595025828, https://leetcode.com/problems/plus-one
203,Remove Linked List Elements,38.6%,Easy,0.006479067005887776, https://leetcode.com/problems/remove-linked-list-elements
1390,Four Divisors,38.1%,Medium,0, https://leetcode.com/problems/four-divisors
1 228 ID Summary Ranges Title 39.5% Acceptance Medium Difficulty 2.379243547602478 Frequency https://leetcode.com/problems/summary-ranges Leetcode Question Link
2 814 228 Binary Tree Pruning Summary Ranges 74.5% 39.5% Medium Medium 1.714403093040326 2.379243547602478 https://leetcode.com/problems/binary-tree-pruning https://leetcode.com/problems/summary-ranges
3 328 814 Odd Even Linked List Binary Tree Pruning 55.7% 74.5% Medium Medium 1.514446116622737 1.714403093040326 https://leetcode.com/problems/odd-even-linked-list https://leetcode.com/problems/binary-tree-pruning
4 138 328 Copy List with Random Pointer Odd Even Linked List 36.4% 55.7% Medium Medium 1.3877294433016032 1.514446116622737 https://leetcode.com/problems/copy-list-with-random-pointer https://leetcode.com/problems/odd-even-linked-list
5 290 138 Word Pattern Copy List with Random Pointer 37.0% 36.4% Easy Medium 1.3013067642290357 1.3877294433016032 https://leetcode.com/problems/word-pattern https://leetcode.com/problems/copy-list-with-random-pointer
6 2 290 Add Two Numbers Word Pattern 33.9% 37.0% Medium Easy 1.2542105308123643 1.3013067642290357 https://leetcode.com/problems/add-two-numbers https://leetcode.com/problems/word-pattern
7 322 2 Coin Change Add Two Numbers 35.5% 33.9% Medium Medium 1.0832857985041888 1.2542105308123643 https://leetcode.com/problems/coin-change https://leetcode.com/problems/add-two-numbers
8 412 322 Fizz Buzz Coin Change 62.3% 35.5% Easy Medium 0.41844534394203714 1.0832857985041888 https://leetcode.com/problems/fizz-buzz https://leetcode.com/problems/coin-change
9 1071 412 Greatest Common Divisor of Strings Fizz Buzz 52.9% 62.3% Easy Easy 0.4175376893424336 0.41844534394203714 https://leetcode.com/problems/greatest-common-divisor-of-strings https://leetcode.com/problems/fizz-buzz
10 273 1071 Integer to English Words Greatest Common Divisor of Strings 27.1% 52.9% Hard Easy 0.26532833604818473 0.4175376893424336 https://leetcode.com/problems/integer-to-english-words https://leetcode.com/problems/greatest-common-divisor-of-strings
11 204 273 Count Primes Integer to English Words 31.5% 27.1% Easy Hard 0.1633347782917643 0.26532833604818473 https://leetcode.com/problems/count-primes https://leetcode.com/problems/integer-to-english-words
12 98 204 Validate Binary Search Tree Count Primes 27.8% 31.5% Medium Easy 0.07111326337575957 0.1633347782917643 https://leetcode.com/problems/validate-binary-search-tree https://leetcode.com/problems/count-primes
13 53 98 Maximum Subarray Validate Binary Search Tree 46.5% 27.8% Easy Medium 0.052816160704876255 0.07111326337575957 https://leetcode.com/problems/maximum-subarray https://leetcode.com/problems/validate-binary-search-tree
14 21 53 Merge Two Sorted Lists Maximum Subarray 53.5% 46.5% Easy Easy 0.014012111332134735 0.052816160704876255 https://leetcode.com/problems/merge-two-sorted-lists https://leetcode.com/problems/maximum-subarray
15 66 21 Plus One Merge Two Sorted Lists 43.0% 53.5% Easy Easy 0.007324847595025828 0.014012111332134735 https://leetcode.com/problems/plus-one https://leetcode.com/problems/merge-two-sorted-lists
16 203 66 Remove Linked List Elements Plus One 38.6% 43.0% Easy Easy 0.006479067005887776 0.007324847595025828 https://leetcode.com/problems/remove-linked-list-elements https://leetcode.com/problems/plus-one
17 1390 203 Four Divisors Remove Linked List Elements 38.1% 38.6% Medium Easy 0 0.006479067005887776 https://leetcode.com/problems/four-divisors https://leetcode.com/problems/remove-linked-list-elements
18 1390 Four Divisors 38.1% Medium 0 https://leetcode.com/problems/four-divisors