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,24 +1,25 @@
735,Asteroid Collision,41.0%,Medium,1.473090540195022, https://leetcode.com/problems/asteroid-collision
238,Product of Array Except Self,60.1%,Medium,1.0067649782470638, https://leetcode.com/problems/product-of-array-except-self
365,Water and Jug Problem,30.6%,Medium,0.8801037398580485, https://leetcode.com/problems/water-and-jug-problem
981,Time Based Key-Value Store,53.1%,Medium,0.8180951326968029, https://leetcode.com/problems/time-based-key-value-store
158,Read N Characters Given Read4 II - Call multiple times,33.8%,Hard,0.752091950433346, https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times
716,Max Stack,42.6%,Easy,0.6330336058902137, https://leetcode.com/problems/max-stack
127,Word Ladder,29.6%,Medium,0.1667080439422554, https://leetcode.com/problems/word-ladder
642,Design Search Autocomplete System,44.7%,Hard,0.16312782492496253, https://leetcode.com/problems/design-search-autocomplete-system
426,Convert Binary Search Tree to Sorted Doubly Linked List,59.1%,Medium,0.09352605801082346, https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list
109,Convert Sorted List to Binary Search Tree,47.7%,Medium,0.08701137698962977, https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
76,Minimum Window Substring,34.6%,Hard,0.05473322196089386, https://leetcode.com/problems/minimum-window-substring
304,Range Sum Query 2D - Immutable,38.6%,Medium,0.054527987071175225, https://leetcode.com/problems/range-sum-query-2d-immutable
91,Decode Ways,24.7%,Medium,0.03673102791879485, https://leetcode.com/problems/decode-ways
1060,Missing Element in Sorted Array,54.5%,Medium,0.017429635135283658, https://leetcode.com/problems/missing-element-in-sorted-array
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
10,Regular Expression Matching,26.8%,Hard,0.01609764684284749, https://leetcode.com/problems/regular-expression-matching
567,Permutation in String,44.4%,Medium,0.014947961435873182, https://leetcode.com/problems/permutation-in-string
88,Merge Sorted Array,39.4%,Easy,0.011986958032982505, https://leetcode.com/problems/merge-sorted-array
48,Rotate Image,56.7%,Medium,0.011428695823622754, https://leetcode.com/problems/rotate-image
20,Valid Parentheses,39.0%,Easy,0.009170695326061695, https://leetcode.com/problems/valid-parentheses
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
349,Intersection of Two Arrays,62.5%,Easy,0.00725034896230682, https://leetcode.com/problems/intersection-of-two-arrays
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
17,Letter Combinations of a Phone Number,46.8%,Medium,0.0044018999217624675, https://leetcode.com/problems/letter-combinations-of-a-phone-number
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
735,Asteroid Collision,41.0%,Medium,1.473090540195022, https://leetcode.com/problems/asteroid-collision
238,Product of Array Except Self,60.1%,Medium,1.0067649782470638, https://leetcode.com/problems/product-of-array-except-self
365,Water and Jug Problem,30.6%,Medium,0.8801037398580485, https://leetcode.com/problems/water-and-jug-problem
981,Time Based Key-Value Store,53.1%,Medium,0.8180951326968029, https://leetcode.com/problems/time-based-key-value-store
158,Read N Characters Given Read4 II - Call multiple times,33.8%,Hard,0.752091950433346, https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times
716,Max Stack,42.6%,Easy,0.6330336058902137, https://leetcode.com/problems/max-stack
127,Word Ladder,29.6%,Medium,0.1667080439422554, https://leetcode.com/problems/word-ladder
642,Design Search Autocomplete System,44.7%,Hard,0.16312782492496253, https://leetcode.com/problems/design-search-autocomplete-system
426,Convert Binary Search Tree to Sorted Doubly Linked List,59.1%,Medium,0.09352605801082346, https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list
109,Convert Sorted List to Binary Search Tree,47.7%,Medium,0.08701137698962977, https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
76,Minimum Window Substring,34.6%,Hard,0.05473322196089386, https://leetcode.com/problems/minimum-window-substring
304,Range Sum Query 2D - Immutable,38.6%,Medium,0.054527987071175225, https://leetcode.com/problems/range-sum-query-2d-immutable
91,Decode Ways,24.7%,Medium,0.03673102791879485, https://leetcode.com/problems/decode-ways
1060,Missing Element in Sorted Array,54.5%,Medium,0.017429635135283658, https://leetcode.com/problems/missing-element-in-sorted-array
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
10,Regular Expression Matching,26.8%,Hard,0.01609764684284749, https://leetcode.com/problems/regular-expression-matching
567,Permutation in String,44.4%,Medium,0.014947961435873182, https://leetcode.com/problems/permutation-in-string
88,Merge Sorted Array,39.4%,Easy,0.011986958032982505, https://leetcode.com/problems/merge-sorted-array
48,Rotate Image,56.7%,Medium,0.011428695823622754, https://leetcode.com/problems/rotate-image
20,Valid Parentheses,39.0%,Easy,0.009170695326061695, https://leetcode.com/problems/valid-parentheses
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
349,Intersection of Two Arrays,62.5%,Easy,0.00725034896230682, https://leetcode.com/problems/intersection-of-two-arrays
146,LRU Cache,33.2%,Medium,0.004600353139061353, https://leetcode.com/problems/lru-cache
17,Letter Combinations of a Phone Number,46.8%,Medium,0.0044018999217624675, https://leetcode.com/problems/letter-combinations-of-a-phone-number
1 735 ID Asteroid Collision Title 41.0% Acceptance Medium Difficulty 1.473090540195022 Frequency https://leetcode.com/problems/asteroid-collision Leetcode Question Link
2 238 735 Product of Array Except Self Asteroid Collision 60.1% 41.0% Medium Medium 1.0067649782470638 1.473090540195022 https://leetcode.com/problems/product-of-array-except-self https://leetcode.com/problems/asteroid-collision
3 365 238 Water and Jug Problem Product of Array Except Self 30.6% 60.1% Medium Medium 0.8801037398580485 1.0067649782470638 https://leetcode.com/problems/water-and-jug-problem https://leetcode.com/problems/product-of-array-except-self
4 981 365 Time Based Key-Value Store Water and Jug Problem 53.1% 30.6% Medium Medium 0.8180951326968029 0.8801037398580485 https://leetcode.com/problems/time-based-key-value-store https://leetcode.com/problems/water-and-jug-problem
5 158 981 Read N Characters Given Read4 II - Call multiple times Time Based Key-Value Store 33.8% 53.1% Hard Medium 0.752091950433346 0.8180951326968029 https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times https://leetcode.com/problems/time-based-key-value-store
6 716 158 Max Stack Read N Characters Given Read4 II - Call multiple times 42.6% 33.8% Easy Hard 0.6330336058902137 0.752091950433346 https://leetcode.com/problems/max-stack https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times
7 127 716 Word Ladder Max Stack 29.6% 42.6% Medium Easy 0.1667080439422554 0.6330336058902137 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/max-stack
8 642 127 Design Search Autocomplete System Word Ladder 44.7% 29.6% Hard Medium 0.16312782492496253 0.1667080439422554 https://leetcode.com/problems/design-search-autocomplete-system https://leetcode.com/problems/word-ladder
9 426 642 Convert Binary Search Tree to Sorted Doubly Linked List Design Search Autocomplete System 59.1% 44.7% Medium Hard 0.09352605801082346 0.16312782492496253 https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list https://leetcode.com/problems/design-search-autocomplete-system
10 109 426 Convert Sorted List to Binary Search Tree Convert Binary Search Tree to Sorted Doubly Linked List 47.7% 59.1% Medium Medium 0.08701137698962977 0.09352605801082346 https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list
11 76 109 Minimum Window Substring Convert Sorted List to Binary Search Tree 34.6% 47.7% Hard Medium 0.05473322196089386 0.08701137698962977 https://leetcode.com/problems/minimum-window-substring https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
12 304 76 Range Sum Query 2D - Immutable Minimum Window Substring 38.6% 34.6% Medium Hard 0.054527987071175225 0.05473322196089386 https://leetcode.com/problems/range-sum-query-2d-immutable https://leetcode.com/problems/minimum-window-substring
13 91 304 Decode Ways Range Sum Query 2D - Immutable 24.7% 38.6% Medium Medium 0.03673102791879485 0.054527987071175225 https://leetcode.com/problems/decode-ways https://leetcode.com/problems/range-sum-query-2d-immutable
14 1060 91 Missing Element in Sorted Array Decode Ways 54.5% 24.7% Medium Medium 0.017429635135283658 0.03673102791879485 https://leetcode.com/problems/missing-element-in-sorted-array https://leetcode.com/problems/decode-ways
15 23 1060 Merge k Sorted Lists Missing Element in Sorted Array 40.2% 54.5% Hard Medium 0.016108271385328228 0.017429635135283658 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/missing-element-in-sorted-array
16 10 23 Regular Expression Matching Merge k Sorted Lists 26.8% 40.2% Hard Hard 0.01609764684284749 0.016108271385328228 https://leetcode.com/problems/regular-expression-matching https://leetcode.com/problems/merge-k-sorted-lists
17 567 10 Permutation in String Regular Expression Matching 44.4% 26.8% Medium Hard 0.014947961435873182 0.01609764684284749 https://leetcode.com/problems/permutation-in-string https://leetcode.com/problems/regular-expression-matching
18 88 567 Merge Sorted Array Permutation in String 39.4% 44.4% Easy Medium 0.011986958032982505 0.014947961435873182 https://leetcode.com/problems/merge-sorted-array https://leetcode.com/problems/permutation-in-string
19 48 88 Rotate Image Merge Sorted Array 56.7% 39.4% Medium Easy 0.011428695823622754 0.011986958032982505 https://leetcode.com/problems/rotate-image https://leetcode.com/problems/merge-sorted-array
20 20 48 Valid Parentheses Rotate Image 39.0% 56.7% Easy Medium 0.009170695326061695 0.011428695823622754 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/rotate-image
21 253 20 Meeting Rooms II Valid Parentheses 45.7% 39.0% Medium Easy 0.008079219870546493 0.009170695326061695 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/valid-parentheses
22 349 253 Intersection of Two Arrays Meeting Rooms II 62.5% 45.7% Easy Medium 0.00725034896230682 0.008079219870546493 https://leetcode.com/problems/intersection-of-two-arrays https://leetcode.com/problems/meeting-rooms-ii
23 146 349 LRU Cache Intersection of Two Arrays 33.2% 62.5% Medium Easy 0.004600353139061353 0.00725034896230682 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/intersection-of-two-arrays
24 17 146 Letter Combinations of a Phone Number LRU Cache 46.8% 33.2% Medium Medium 0.0044018999217624675 0.004600353139061353 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/lru-cache
25 17 Letter Combinations of a Phone Number 46.8% Medium 0.0044018999217624675 https://leetcode.com/problems/letter-combinations-of-a-phone-number