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 @@
735,Asteroid Collision,41.0%,Medium,0.4807449678769452, https://leetcode.com/problems/asteroid-collision
365,Water and Jug Problem,30.6%,Medium,0.36154113358990525, https://leetcode.com/problems/water-and-jug-problem
981,Time Based Key-Value Store,53.1%,Medium,0.24353082235287765, https://leetcode.com/problems/time-based-key-value-store
238,Product of Array Except Self,60.1%,Medium,0.22477655808124566, https://leetcode.com/problems/product-of-array-except-self
158,Read N Characters Given Read4 II - Call multiple times,33.8%,Hard,0.21421194491522716, https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times
642,Design Search Autocomplete System,44.7%,Hard,0.09500811062818718, https://leetcode.com/problems/design-search-autocomplete-system
716,Max Stack,42.6%,Easy,0.09362342046209744, https://leetcode.com/problems/max-stack
304,Range Sum Query 2D - Immutable,38.6%,Medium,0.054527987071175225, https://leetcode.com/problems/range-sum-query-2d-immutable
127,Word Ladder,29.6%,Medium,0.03679590970204585, https://leetcode.com/problems/word-ladder
91,Decode Ways,24.7%,Medium,0.023662742620848144, https://leetcode.com/problems/decode-ways
567,Permutation in String,44.4%,Medium,0.014947961435873182, https://leetcode.com/problems/permutation-in-string
109,Convert Sorted List to Binary Search Tree,47.7%,Medium,0.014440684154794336, https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
88,Merge Sorted Array,39.4%,Easy,0.006760335218638243, https://leetcode.com/problems/merge-sorted-array
76,Minimum Window Substring,34.6%,Hard,0.006231520398723243, https://leetcode.com/problems/minimum-window-substring
17,Letter Combinations of a Phone Number,46.8%,Medium,0.0044018999217624675, https://leetcode.com/problems/letter-combinations-of-a-phone-number
23,Merge k Sorted Lists,40.2%,Hard,0.004051459000748015, https://leetcode.com/problems/merge-k-sorted-lists
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
735,Asteroid Collision,41.0%,Medium,0.4807449678769452, https://leetcode.com/problems/asteroid-collision
365,Water and Jug Problem,30.6%,Medium,0.36154113358990525, https://leetcode.com/problems/water-and-jug-problem
981,Time Based Key-Value Store,53.1%,Medium,0.24353082235287765, https://leetcode.com/problems/time-based-key-value-store
238,Product of Array Except Self,60.1%,Medium,0.22477655808124566, https://leetcode.com/problems/product-of-array-except-self
158,Read N Characters Given Read4 II - Call multiple times,33.8%,Hard,0.21421194491522716, https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times
642,Design Search Autocomplete System,44.7%,Hard,0.09500811062818718, https://leetcode.com/problems/design-search-autocomplete-system
716,Max Stack,42.6%,Easy,0.09362342046209744, https://leetcode.com/problems/max-stack
304,Range Sum Query 2D - Immutable,38.6%,Medium,0.054527987071175225, https://leetcode.com/problems/range-sum-query-2d-immutable
127,Word Ladder,29.6%,Medium,0.03679590970204585, https://leetcode.com/problems/word-ladder
91,Decode Ways,24.7%,Medium,0.023662742620848144, https://leetcode.com/problems/decode-ways
567,Permutation in String,44.4%,Medium,0.014947961435873182, https://leetcode.com/problems/permutation-in-string
109,Convert Sorted List to Binary Search Tree,47.7%,Medium,0.014440684154794336, https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
88,Merge Sorted Array,39.4%,Easy,0.006760335218638243, https://leetcode.com/problems/merge-sorted-array
76,Minimum Window Substring,34.6%,Hard,0.006231520398723243, https://leetcode.com/problems/minimum-window-substring
17,Letter Combinations of a Phone Number,46.8%,Medium,0.0044018999217624675, https://leetcode.com/problems/letter-combinations-of-a-phone-number
23,Merge k Sorted Lists,40.2%,Hard,0.004051459000748015, https://leetcode.com/problems/merge-k-sorted-lists
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
1 735 ID Asteroid Collision Title 41.0% Acceptance Medium Difficulty 0.4807449678769452 Frequency https://leetcode.com/problems/asteroid-collision Leetcode Question Link
2 365 735 Water and Jug Problem Asteroid Collision 30.6% 41.0% Medium Medium 0.36154113358990525 0.4807449678769452 https://leetcode.com/problems/water-and-jug-problem https://leetcode.com/problems/asteroid-collision
3 981 365 Time Based Key-Value Store Water and Jug Problem 53.1% 30.6% Medium Medium 0.24353082235287765 0.36154113358990525 https://leetcode.com/problems/time-based-key-value-store https://leetcode.com/problems/water-and-jug-problem
4 238 981 Product of Array Except Self Time Based Key-Value Store 60.1% 53.1% Medium Medium 0.22477655808124566 0.24353082235287765 https://leetcode.com/problems/product-of-array-except-self https://leetcode.com/problems/time-based-key-value-store
5 158 238 Read N Characters Given Read4 II - Call multiple times Product of Array Except Self 33.8% 60.1% Hard Medium 0.21421194491522716 0.22477655808124566 https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times https://leetcode.com/problems/product-of-array-except-self
6 642 158 Design Search Autocomplete System Read N Characters Given Read4 II - Call multiple times 44.7% 33.8% Hard Hard 0.09500811062818718 0.21421194491522716 https://leetcode.com/problems/design-search-autocomplete-system https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times
7 716 642 Max Stack Design Search Autocomplete System 42.6% 44.7% Easy Hard 0.09362342046209744 0.09500811062818718 https://leetcode.com/problems/max-stack https://leetcode.com/problems/design-search-autocomplete-system
8 304 716 Range Sum Query 2D - Immutable Max Stack 38.6% 42.6% Medium Easy 0.054527987071175225 0.09362342046209744 https://leetcode.com/problems/range-sum-query-2d-immutable https://leetcode.com/problems/max-stack
9 127 304 Word Ladder Range Sum Query 2D - Immutable 29.6% 38.6% Medium Medium 0.03679590970204585 0.054527987071175225 https://leetcode.com/problems/word-ladder https://leetcode.com/problems/range-sum-query-2d-immutable
10 91 127 Decode Ways Word Ladder 24.7% 29.6% Medium Medium 0.023662742620848144 0.03679590970204585 https://leetcode.com/problems/decode-ways https://leetcode.com/problems/word-ladder
11 567 91 Permutation in String Decode Ways 44.4% 24.7% Medium Medium 0.014947961435873182 0.023662742620848144 https://leetcode.com/problems/permutation-in-string https://leetcode.com/problems/decode-ways
12 109 567 Convert Sorted List to Binary Search Tree Permutation in String 47.7% 44.4% Medium Medium 0.014440684154794336 0.014947961435873182 https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree https://leetcode.com/problems/permutation-in-string
13 88 109 Merge Sorted Array Convert Sorted List to Binary Search Tree 39.4% 47.7% Easy Medium 0.006760335218638243 0.014440684154794336 https://leetcode.com/problems/merge-sorted-array https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
14 76 88 Minimum Window Substring Merge Sorted Array 34.6% 39.4% Hard Easy 0.006231520398723243 0.006760335218638243 https://leetcode.com/problems/minimum-window-substring https://leetcode.com/problems/merge-sorted-array
15 17 76 Letter Combinations of a Phone Number Minimum Window Substring 46.8% 34.6% Medium Hard 0.0044018999217624675 0.006231520398723243 https://leetcode.com/problems/letter-combinations-of-a-phone-number https://leetcode.com/problems/minimum-window-substring
16 23 17 Merge k Sorted Lists Letter Combinations of a Phone Number 40.2% 46.8% Hard Medium 0.004051459000748015 0.0044018999217624675 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/letter-combinations-of-a-phone-number
17 20 23 Valid Parentheses Merge k Sorted Lists 39.0% 40.2% Easy Hard 0.0023005704055949323 0.004051459000748015 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/merge-k-sorted-lists
18 20 Valid Parentheses 39.0% Easy 0.0023005704055949323 https://leetcode.com/problems/valid-parentheses