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,14 +1,15 @@
592,Fraction Addition and Subtraction,49.0%,Medium,1.0862508215008657, https://leetcode.com/problems/fraction-addition-and-subtraction
691,Stickers to Spell Word,42.9%,Hard,0.6866391392689652, https://leetcode.com/problems/stickers-to-spell-word
166,Fraction to Recurring Decimal,21.6%,Medium,0.6608271814955181, https://leetcode.com/problems/fraction-to-recurring-decimal
945,Minimum Increment to Make Array Unique,46.3%,Medium,0.26121549926361765, https://leetcode.com/problems/minimum-increment-to-make-array-unique
697,Degree of an Array,53.8%,Easy,0.11752319415823444, https://leetcode.com/problems/degree-of-an-array
234,Palindrome Linked List,39.3%,Easy,0.1029927766102897, https://leetcode.com/problems/palindrome-linked-list
598,Range Addition II,49.6%,Easy,0.09763846956391599, https://leetcode.com/problems/range-addition-ii
23,Merge k Sorted Lists,40.2%,Hard,0.0464758840344532, https://leetcode.com/problems/merge-k-sorted-lists
717,1-bit and 2-bit Characters,48.8%,Easy,0.024346911678336462, https://leetcode.com/problems/1-bit-and-2-bit-characters
162,Find Peak Element,43.3%,Medium,0.013607709218149423, https://leetcode.com/problems/find-peak-element
14,Longest Common Prefix,35.4%,Easy,0.012650390082165711, https://leetcode.com/problems/longest-common-prefix
227,Basic Calculator II,36.9%,Medium,0.0118801516064451, https://leetcode.com/problems/basic-calculator-ii
518,Coin Change 2,50.2%,Medium,0.011844971180548993, https://leetcode.com/problems/coin-change-2
33,Search in Rotated Sorted Array,34.5%,Medium,0.0031000567336666443, https://leetcode.com/problems/search-in-rotated-sorted-array
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
592,Fraction Addition and Subtraction,49.0%,Medium,1.0862508215008657, https://leetcode.com/problems/fraction-addition-and-subtraction
691,Stickers to Spell Word,42.9%,Hard,0.6866391392689652, https://leetcode.com/problems/stickers-to-spell-word
166,Fraction to Recurring Decimal,21.6%,Medium,0.6608271814955181, https://leetcode.com/problems/fraction-to-recurring-decimal
945,Minimum Increment to Make Array Unique,46.3%,Medium,0.26121549926361765, https://leetcode.com/problems/minimum-increment-to-make-array-unique
697,Degree of an Array,53.8%,Easy,0.11752319415823444, https://leetcode.com/problems/degree-of-an-array
234,Palindrome Linked List,39.3%,Easy,0.1029927766102897, https://leetcode.com/problems/palindrome-linked-list
598,Range Addition II,49.6%,Easy,0.09763846956391599, https://leetcode.com/problems/range-addition-ii
23,Merge k Sorted Lists,40.2%,Hard,0.0464758840344532, https://leetcode.com/problems/merge-k-sorted-lists
717,1-bit and 2-bit Characters,48.8%,Easy,0.024346911678336462, https://leetcode.com/problems/1-bit-and-2-bit-characters
162,Find Peak Element,43.3%,Medium,0.013607709218149423, https://leetcode.com/problems/find-peak-element
14,Longest Common Prefix,35.4%,Easy,0.012650390082165711, https://leetcode.com/problems/longest-common-prefix
227,Basic Calculator II,36.9%,Medium,0.0118801516064451, https://leetcode.com/problems/basic-calculator-ii
518,Coin Change 2,50.2%,Medium,0.011844971180548993, https://leetcode.com/problems/coin-change-2
33,Search in Rotated Sorted Array,34.5%,Medium,0.0031000567336666443, https://leetcode.com/problems/search-in-rotated-sorted-array
1 592 ID Fraction Addition and Subtraction Title 49.0% Acceptance Medium Difficulty 1.0862508215008657 Frequency https://leetcode.com/problems/fraction-addition-and-subtraction Leetcode Question Link
2 691 592 Stickers to Spell Word Fraction Addition and Subtraction 42.9% 49.0% Hard Medium 0.6866391392689652 1.0862508215008657 https://leetcode.com/problems/stickers-to-spell-word https://leetcode.com/problems/fraction-addition-and-subtraction
3 166 691 Fraction to Recurring Decimal Stickers to Spell Word 21.6% 42.9% Medium Hard 0.6608271814955181 0.6866391392689652 https://leetcode.com/problems/fraction-to-recurring-decimal https://leetcode.com/problems/stickers-to-spell-word
4 945 166 Minimum Increment to Make Array Unique Fraction to Recurring Decimal 46.3% 21.6% Medium Medium 0.26121549926361765 0.6608271814955181 https://leetcode.com/problems/minimum-increment-to-make-array-unique https://leetcode.com/problems/fraction-to-recurring-decimal
5 697 945 Degree of an Array Minimum Increment to Make Array Unique 53.8% 46.3% Easy Medium 0.11752319415823444 0.26121549926361765 https://leetcode.com/problems/degree-of-an-array https://leetcode.com/problems/minimum-increment-to-make-array-unique
6 234 697 Palindrome Linked List Degree of an Array 39.3% 53.8% Easy Easy 0.1029927766102897 0.11752319415823444 https://leetcode.com/problems/palindrome-linked-list https://leetcode.com/problems/degree-of-an-array
7 598 234 Range Addition II Palindrome Linked List 49.6% 39.3% Easy Easy 0.09763846956391599 0.1029927766102897 https://leetcode.com/problems/range-addition-ii https://leetcode.com/problems/palindrome-linked-list
8 23 598 Merge k Sorted Lists Range Addition II 40.2% 49.6% Hard Easy 0.0464758840344532 0.09763846956391599 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/range-addition-ii
9 717 23 1-bit and 2-bit Characters Merge k Sorted Lists 48.8% 40.2% Easy Hard 0.024346911678336462 0.0464758840344532 https://leetcode.com/problems/1-bit-and-2-bit-characters https://leetcode.com/problems/merge-k-sorted-lists
10 162 717 Find Peak Element 1-bit and 2-bit Characters 43.3% 48.8% Medium Easy 0.013607709218149423 0.024346911678336462 https://leetcode.com/problems/find-peak-element https://leetcode.com/problems/1-bit-and-2-bit-characters
11 14 162 Longest Common Prefix Find Peak Element 35.4% 43.3% Easy Medium 0.012650390082165711 0.013607709218149423 https://leetcode.com/problems/longest-common-prefix https://leetcode.com/problems/find-peak-element
12 227 14 Basic Calculator II Longest Common Prefix 36.9% 35.4% Medium Easy 0.0118801516064451 0.012650390082165711 https://leetcode.com/problems/basic-calculator-ii https://leetcode.com/problems/longest-common-prefix
13 518 227 Coin Change 2 Basic Calculator II 50.2% 36.9% Medium Medium 0.011844971180548993 0.0118801516064451 https://leetcode.com/problems/coin-change-2 https://leetcode.com/problems/basic-calculator-ii
14 33 518 Search in Rotated Sorted Array Coin Change 2 34.5% 50.2% Medium Medium 0.0031000567336666443 0.011844971180548993 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/coin-change-2
15 33 Search in Rotated Sorted Array 34.5% Medium 0.0031000567336666443 https://leetcode.com/problems/search-in-rotated-sorted-array