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,28 +1,29 @@
256,Paint House,52.1%,Easy,0.8299890646199083, https://leetcode.com/problems/paint-house
780,Reaching Points,29.4%,Hard,0.6779561713749561, https://leetcode.com/problems/reaching-points
635,Design Log Storage System,58.6%,Medium,0.48162092276953306, https://leetcode.com/problems/design-log-storage-system
57,Insert Interval,33.5%,Hard,0.28528567416411, https://leetcode.com/problems/insert-interval
1326,Minimum Number of Taps to Open to Water a Garden,43.6%,Hard,0.2786048543006643, https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden
945,Minimum Increment to Make Array Unique,46.3%,Medium,0.27427904232444056, https://leetcode.com/problems/minimum-increment-to-make-array-unique
547,Friend Circles,58.6%,Medium,0.22246660738239243, https://leetcode.com/problems/friend-circles
532,K-diff Pairs in an Array,31.6%,Easy,0.15718558352241233, https://leetcode.com/problems/k-diff-pairs-in-an-array
647,Palindromic Substrings,60.6%,Medium,0.06329624434241725, https://leetcode.com/problems/palindromic-substrings
307,Range Sum Query - Mutable,34.6%,Medium,0.04935211978972769, https://leetcode.com/problems/range-sum-query-mutable
341,Flatten Nested List Iterator,52.9%,Medium,0.04440788848944038, https://leetcode.com/problems/flatten-nested-list-iterator
716,Max Stack,42.6%,Easy,0.042695919196489414, https://leetcode.com/problems/max-stack
161,One Edit Distance,32.3%,Medium,0.03626870773745257, https://leetcode.com/problems/one-edit-distance
528,Random Pick with Weight,43.9%,Medium,0.03306693626657339, https://leetcode.com/problems/random-pick-with-weight
496,Next Greater Element I,63.8%,Easy,0.029462032730316202, https://leetcode.com/problems/next-greater-element-i
981,Time Based Key-Value Store,53.1%,Medium,0.02226024024151985, https://leetcode.com/problems/time-based-key-value-store
540,Single Element in a Sorted Array,57.9%,Medium,0.0192128868599912, https://leetcode.com/problems/single-element-in-a-sorted-array
239,Sliding Window Maximum,43.0%,Hard,0.01768566434627554, https://leetcode.com/problems/sliding-window-maximum
706,Design HashMap,61.3%,Easy,0.01752893260576219, https://leetcode.com/problems/design-hashmap
767,Reorganize String,48.7%,Medium,0.01329806830463147, https://leetcode.com/problems/reorganize-string
269,Alien Dictionary,33.3%,Hard,0.012730916694039954, https://leetcode.com/problems/alien-dictionary
23,Merge k Sorted Lists,40.2%,Hard,0.009092808657599025, https://leetcode.com/problems/merge-k-sorted-lists
10,Regular Expression Matching,26.8%,Hard,0.0071865203293987245, https://leetcode.com/problems/regular-expression-matching
105,Construct Binary Tree from Preorder and Inorder Traversal,48.8%,Medium,0.005628268691614718, https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
139,Word Break,40.1%,Medium,0.003894465052690167, https://leetcode.com/problems/word-break
56,Merge Intervals,39.3%,Medium,0.0034728286335985107, https://leetcode.com/problems/merge-intervals
210,Course Schedule II,40.7%,Medium,0.0019086707135282834, https://leetcode.com/problems/course-schedule-ii
1,Two Sum,45.6%,Easy,0.0008206138651873125, https://leetcode.com/problems/two-sum
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
256,Paint House,52.1%,Easy,0.8299890646199083, https://leetcode.com/problems/paint-house
780,Reaching Points,29.4%,Hard,0.6779561713749561, https://leetcode.com/problems/reaching-points
635,Design Log Storage System,58.6%,Medium,0.48162092276953306, https://leetcode.com/problems/design-log-storage-system
57,Insert Interval,33.5%,Hard,0.28528567416411, https://leetcode.com/problems/insert-interval
1326,Minimum Number of Taps to Open to Water a Garden,43.6%,Hard,0.2786048543006643, https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden
945,Minimum Increment to Make Array Unique,46.3%,Medium,0.27427904232444056, https://leetcode.com/problems/minimum-increment-to-make-array-unique
547,Friend Circles,58.6%,Medium,0.22246660738239243, https://leetcode.com/problems/friend-circles
532,K-diff Pairs in an Array,31.6%,Easy,0.15718558352241233, https://leetcode.com/problems/k-diff-pairs-in-an-array
647,Palindromic Substrings,60.6%,Medium,0.06329624434241725, https://leetcode.com/problems/palindromic-substrings
307,Range Sum Query - Mutable,34.6%,Medium,0.04935211978972769, https://leetcode.com/problems/range-sum-query-mutable
341,Flatten Nested List Iterator,52.9%,Medium,0.04440788848944038, https://leetcode.com/problems/flatten-nested-list-iterator
716,Max Stack,42.6%,Easy,0.042695919196489414, https://leetcode.com/problems/max-stack
161,One Edit Distance,32.3%,Medium,0.03626870773745257, https://leetcode.com/problems/one-edit-distance
528,Random Pick with Weight,43.9%,Medium,0.03306693626657339, https://leetcode.com/problems/random-pick-with-weight
496,Next Greater Element I,63.8%,Easy,0.029462032730316202, https://leetcode.com/problems/next-greater-element-i
981,Time Based Key-Value Store,53.1%,Medium,0.02226024024151985, https://leetcode.com/problems/time-based-key-value-store
540,Single Element in a Sorted Array,57.9%,Medium,0.0192128868599912, https://leetcode.com/problems/single-element-in-a-sorted-array
239,Sliding Window Maximum,43.0%,Hard,0.01768566434627554, https://leetcode.com/problems/sliding-window-maximum
706,Design HashMap,61.3%,Easy,0.01752893260576219, https://leetcode.com/problems/design-hashmap
767,Reorganize String,48.7%,Medium,0.01329806830463147, https://leetcode.com/problems/reorganize-string
269,Alien Dictionary,33.3%,Hard,0.012730916694039954, https://leetcode.com/problems/alien-dictionary
23,Merge k Sorted Lists,40.2%,Hard,0.009092808657599025, https://leetcode.com/problems/merge-k-sorted-lists
10,Regular Expression Matching,26.8%,Hard,0.0071865203293987245, https://leetcode.com/problems/regular-expression-matching
105,Construct Binary Tree from Preorder and Inorder Traversal,48.8%,Medium,0.005628268691614718, https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
139,Word Break,40.1%,Medium,0.003894465052690167, https://leetcode.com/problems/word-break
56,Merge Intervals,39.3%,Medium,0.0034728286335985107, https://leetcode.com/problems/merge-intervals
210,Course Schedule II,40.7%,Medium,0.0019086707135282834, https://leetcode.com/problems/course-schedule-ii
1,Two Sum,45.6%,Easy,0.0008206138651873125, https://leetcode.com/problems/two-sum
1 256 ID Paint House Title 52.1% Acceptance Easy Difficulty 0.8299890646199083 Frequency https://leetcode.com/problems/paint-house Leetcode Question Link
2 780 256 Reaching Points Paint House 29.4% 52.1% Hard Easy 0.6779561713749561 0.8299890646199083 https://leetcode.com/problems/reaching-points https://leetcode.com/problems/paint-house
3 635 780 Design Log Storage System Reaching Points 58.6% 29.4% Medium Hard 0.48162092276953306 0.6779561713749561 https://leetcode.com/problems/design-log-storage-system https://leetcode.com/problems/reaching-points
4 57 635 Insert Interval Design Log Storage System 33.5% 58.6% Hard Medium 0.28528567416411 0.48162092276953306 https://leetcode.com/problems/insert-interval https://leetcode.com/problems/design-log-storage-system
5 1326 57 Minimum Number of Taps to Open to Water a Garden Insert Interval 43.6% 33.5% Hard Hard 0.2786048543006643 0.28528567416411 https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden https://leetcode.com/problems/insert-interval
6 945 1326 Minimum Increment to Make Array Unique Minimum Number of Taps to Open to Water a Garden 46.3% 43.6% Medium Hard 0.27427904232444056 0.2786048543006643 https://leetcode.com/problems/minimum-increment-to-make-array-unique https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden
7 547 945 Friend Circles Minimum Increment to Make Array Unique 58.6% 46.3% Medium Medium 0.22246660738239243 0.27427904232444056 https://leetcode.com/problems/friend-circles https://leetcode.com/problems/minimum-increment-to-make-array-unique
8 532 547 K-diff Pairs in an Array Friend Circles 31.6% 58.6% Easy Medium 0.15718558352241233 0.22246660738239243 https://leetcode.com/problems/k-diff-pairs-in-an-array https://leetcode.com/problems/friend-circles
9 647 532 Palindromic Substrings K-diff Pairs in an Array 60.6% 31.6% Medium Easy 0.06329624434241725 0.15718558352241233 https://leetcode.com/problems/palindromic-substrings https://leetcode.com/problems/k-diff-pairs-in-an-array
10 307 647 Range Sum Query - Mutable Palindromic Substrings 34.6% 60.6% Medium Medium 0.04935211978972769 0.06329624434241725 https://leetcode.com/problems/range-sum-query-mutable https://leetcode.com/problems/palindromic-substrings
11 341 307 Flatten Nested List Iterator Range Sum Query - Mutable 52.9% 34.6% Medium Medium 0.04440788848944038 0.04935211978972769 https://leetcode.com/problems/flatten-nested-list-iterator https://leetcode.com/problems/range-sum-query-mutable
12 716 341 Max Stack Flatten Nested List Iterator 42.6% 52.9% Easy Medium 0.042695919196489414 0.04440788848944038 https://leetcode.com/problems/max-stack https://leetcode.com/problems/flatten-nested-list-iterator
13 161 716 One Edit Distance Max Stack 32.3% 42.6% Medium Easy 0.03626870773745257 0.042695919196489414 https://leetcode.com/problems/one-edit-distance https://leetcode.com/problems/max-stack
14 528 161 Random Pick with Weight One Edit Distance 43.9% 32.3% Medium Medium 0.03306693626657339 0.03626870773745257 https://leetcode.com/problems/random-pick-with-weight https://leetcode.com/problems/one-edit-distance
15 496 528 Next Greater Element I Random Pick with Weight 63.8% 43.9% Easy Medium 0.029462032730316202 0.03306693626657339 https://leetcode.com/problems/next-greater-element-i https://leetcode.com/problems/random-pick-with-weight
16 981 496 Time Based Key-Value Store Next Greater Element I 53.1% 63.8% Medium Easy 0.02226024024151985 0.029462032730316202 https://leetcode.com/problems/time-based-key-value-store https://leetcode.com/problems/next-greater-element-i
17 540 981 Single Element in a Sorted Array Time Based Key-Value Store 57.9% 53.1% Medium Medium 0.0192128868599912 0.02226024024151985 https://leetcode.com/problems/single-element-in-a-sorted-array https://leetcode.com/problems/time-based-key-value-store
18 239 540 Sliding Window Maximum Single Element in a Sorted Array 43.0% 57.9% Hard Medium 0.01768566434627554 0.0192128868599912 https://leetcode.com/problems/sliding-window-maximum https://leetcode.com/problems/single-element-in-a-sorted-array
19 706 239 Design HashMap Sliding Window Maximum 61.3% 43.0% Easy Hard 0.01752893260576219 0.01768566434627554 https://leetcode.com/problems/design-hashmap https://leetcode.com/problems/sliding-window-maximum
20 767 706 Reorganize String Design HashMap 48.7% 61.3% Medium Easy 0.01329806830463147 0.01752893260576219 https://leetcode.com/problems/reorganize-string https://leetcode.com/problems/design-hashmap
21 269 767 Alien Dictionary Reorganize String 33.3% 48.7% Hard Medium 0.012730916694039954 0.01329806830463147 https://leetcode.com/problems/alien-dictionary https://leetcode.com/problems/reorganize-string
22 23 269 Merge k Sorted Lists Alien Dictionary 40.2% 33.3% Hard Hard 0.009092808657599025 0.012730916694039954 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/alien-dictionary
23 10 23 Regular Expression Matching Merge k Sorted Lists 26.8% 40.2% Hard Hard 0.0071865203293987245 0.009092808657599025 https://leetcode.com/problems/regular-expression-matching https://leetcode.com/problems/merge-k-sorted-lists
24 105 10 Construct Binary Tree from Preorder and Inorder Traversal Regular Expression Matching 48.8% 26.8% Medium Hard 0.005628268691614718 0.0071865203293987245 https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal https://leetcode.com/problems/regular-expression-matching
25 139 105 Word Break Construct Binary Tree from Preorder and Inorder Traversal 40.1% 48.8% Medium Medium 0.003894465052690167 0.005628268691614718 https://leetcode.com/problems/word-break https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal
26 56 139 Merge Intervals Word Break 39.3% 40.1% Medium Medium 0.0034728286335985107 0.003894465052690167 https://leetcode.com/problems/merge-intervals https://leetcode.com/problems/word-break
27 210 56 Course Schedule II Merge Intervals 40.7% 39.3% Medium Medium 0.0019086707135282834 0.0034728286335985107 https://leetcode.com/problems/course-schedule-ii https://leetcode.com/problems/merge-intervals
28 1 210 Two Sum Course Schedule II 45.6% 40.7% Easy Medium 0.0008206138651873125 0.0019086707135282834 https://leetcode.com/problems/two-sum https://leetcode.com/problems/course-schedule-ii
29 1 Two Sum 45.6% Easy 0.0008206138651873125 https://leetcode.com/problems/two-sum