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,18 +1,19 @@
1473,Paint House III,48.1%,Hard,0.3658010975821623, https://leetcode.com/problems/paint-house-iii
1497,Check If Array Pairs Are Divisible by k,41.1%,Medium,0.2357666456855048, https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k
1041,Robot Bounded In Circle,49.6%,Medium,0.10573219378884732, https://leetcode.com/problems/robot-bounded-in-circle
1297,Maximum Number of Occurrences of a Substring,47.3%,Medium,0.07770898432731625, https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
56,Merge Intervals,39.3%,Medium,0.04173304225331761, https://leetcode.com/problems/merge-intervals
324,Wiggle Sort II,29.9%,Medium,0.02898753687325229, https://leetcode.com/problems/wiggle-sort-ii
68,Text Justification,27.7%,Hard,0.0276451606661453, https://leetcode.com/problems/text-justification
12,Integer to Roman,55.1%,Medium,0.019096697456456382, https://leetcode.com/problems/integer-to-roman
73,Set Matrix Zeroes,43.1%,Medium,0.015715357479628243, https://leetcode.com/problems/set-matrix-zeroes
977,Squares of a Sorted Array,72.1%,Easy,0.015474196582597383, https://leetcode.com/problems/squares-of-a-sorted-array
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
20,Valid Parentheses,39.0%,Easy,0.009170695326061695, https://leetcode.com/problems/valid-parentheses
128,Longest Consecutive Sequence,45.1%,Hard,0.009051883485315484, https://leetcode.com/problems/longest-consecutive-sequence
876,Middle of the Linked List,68.4%,Easy,0.007624893975696915, https://leetcode.com/problems/middle-of-the-linked-list
53,Maximum Subarray,46.5%,Easy,0.004869349014182134, https://leetcode.com/problems/maximum-subarray
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
2,Add Two Numbers,33.9%,Medium,0.0016886191111440908, https://leetcode.com/problems/add-two-numbers
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
1473,Paint House III,48.1%,Hard,0.3658010975821623, https://leetcode.com/problems/paint-house-iii
1497,Check If Array Pairs Are Divisible by k,41.1%,Medium,0.2357666456855048, https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k
1041,Robot Bounded In Circle,49.6%,Medium,0.10573219378884732, https://leetcode.com/problems/robot-bounded-in-circle
1297,Maximum Number of Occurrences of a Substring,47.3%,Medium,0.07770898432731625, https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
56,Merge Intervals,39.3%,Medium,0.04173304225331761, https://leetcode.com/problems/merge-intervals
324,Wiggle Sort II,29.9%,Medium,0.02898753687325229, https://leetcode.com/problems/wiggle-sort-ii
68,Text Justification,27.7%,Hard,0.0276451606661453, https://leetcode.com/problems/text-justification
12,Integer to Roman,55.1%,Medium,0.019096697456456382, https://leetcode.com/problems/integer-to-roman
73,Set Matrix Zeroes,43.1%,Medium,0.015715357479628243, https://leetcode.com/problems/set-matrix-zeroes
977,Squares of a Sorted Array,72.1%,Easy,0.015474196582597383, https://leetcode.com/problems/squares-of-a-sorted-array
227,Basic Calculator II,36.9%,Medium,0.01239941490503826, https://leetcode.com/problems/basic-calculator-ii
20,Valid Parentheses,39.0%,Easy,0.009170695326061695, https://leetcode.com/problems/valid-parentheses
128,Longest Consecutive Sequence,45.1%,Hard,0.009051883485315484, https://leetcode.com/problems/longest-consecutive-sequence
876,Middle of the Linked List,68.4%,Easy,0.007624893975696915, https://leetcode.com/problems/middle-of-the-linked-list
53,Maximum Subarray,46.5%,Easy,0.004869349014182134, https://leetcode.com/problems/maximum-subarray
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
2,Add Two Numbers,33.9%,Medium,0.0016886191111440908, https://leetcode.com/problems/add-two-numbers
1 1473 ID Paint House III Title 48.1% Acceptance Hard Difficulty 0.3658010975821623 Frequency https://leetcode.com/problems/paint-house-iii Leetcode Question Link
2 1497 1473 Check If Array Pairs Are Divisible by k Paint House III 41.1% 48.1% Medium Hard 0.2357666456855048 0.3658010975821623 https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k https://leetcode.com/problems/paint-house-iii
3 1041 1497 Robot Bounded In Circle Check If Array Pairs Are Divisible by k 49.6% 41.1% Medium Medium 0.10573219378884732 0.2357666456855048 https://leetcode.com/problems/robot-bounded-in-circle https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k
4 1297 1041 Maximum Number of Occurrences of a Substring Robot Bounded In Circle 47.3% 49.6% Medium Medium 0.07770898432731625 0.10573219378884732 https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring https://leetcode.com/problems/robot-bounded-in-circle
5 56 1297 Merge Intervals Maximum Number of Occurrences of a Substring 39.3% 47.3% Medium Medium 0.04173304225331761 0.07770898432731625 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
6 324 56 Wiggle Sort II Merge Intervals 29.9% 39.3% Medium Medium 0.02898753687325229 0.04173304225331761 https://leetcode.com/problems/wiggle-sort-ii https://leetcode.com/problems/merge-intervals
7 68 324 Text Justification Wiggle Sort II 27.7% 29.9% Hard Medium 0.0276451606661453 0.02898753687325229 https://leetcode.com/problems/text-justification https://leetcode.com/problems/wiggle-sort-ii
8 12 68 Integer to Roman Text Justification 55.1% 27.7% Medium Hard 0.019096697456456382 0.0276451606661453 https://leetcode.com/problems/integer-to-roman https://leetcode.com/problems/text-justification
9 73 12 Set Matrix Zeroes Integer to Roman 43.1% 55.1% Medium Medium 0.015715357479628243 0.019096697456456382 https://leetcode.com/problems/set-matrix-zeroes https://leetcode.com/problems/integer-to-roman
10 977 73 Squares of a Sorted Array Set Matrix Zeroes 72.1% 43.1% Easy Medium 0.015474196582597383 0.015715357479628243 https://leetcode.com/problems/squares-of-a-sorted-array https://leetcode.com/problems/set-matrix-zeroes
11 227 977 Basic Calculator II Squares of a Sorted Array 36.9% 72.1% Medium Easy 0.01239941490503826 0.015474196582597383 https://leetcode.com/problems/basic-calculator-ii https://leetcode.com/problems/squares-of-a-sorted-array
12 20 227 Valid Parentheses Basic Calculator II 39.0% 36.9% Easy Medium 0.009170695326061695 0.01239941490503826 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/basic-calculator-ii
13 128 20 Longest Consecutive Sequence Valid Parentheses 45.1% 39.0% Hard Easy 0.009051883485315484 0.009170695326061695 https://leetcode.com/problems/longest-consecutive-sequence https://leetcode.com/problems/valid-parentheses
14 876 128 Middle of the Linked List Longest Consecutive Sequence 68.4% 45.1% Easy Hard 0.007624893975696915 0.009051883485315484 https://leetcode.com/problems/middle-of-the-linked-list https://leetcode.com/problems/longest-consecutive-sequence
15 53 876 Maximum Subarray Middle of the Linked List 46.5% 68.4% Easy Easy 0.004869349014182134 0.007624893975696915 https://leetcode.com/problems/maximum-subarray https://leetcode.com/problems/middle-of-the-linked-list
16 146 53 LRU Cache Maximum Subarray 33.2% 46.5% Medium Easy 0.004600353139061353 0.004869349014182134 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/maximum-subarray
17 1 146 Two Sum LRU Cache 45.6% 33.2% Easy Medium 0.003278422738041615 0.004600353139061353 https://leetcode.com/problems/two-sum https://leetcode.com/problems/lru-cache
18 2 1 Add Two Numbers Two Sum 33.9% 45.6% Medium Easy 0.0016886191111440908 0.003278422738041615 https://leetcode.com/problems/add-two-numbers https://leetcode.com/problems/two-sum
19 2 Add Two Numbers 33.9% Medium 0.0016886191111440908 https://leetcode.com/problems/add-two-numbers