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,16 +1,17 @@
274,H-Index,36.1%,Medium,0.18810197835269699, https://leetcode.com/problems/h-index
146,LRU Cache,33.2%,Medium,0.14642426807449366, https://leetcode.com/problems/lru-cache
149,Max Points on a Line,16.9%,Hard,0.13811211729480913, https://leetcode.com/problems/max-points-on-a-line
1213,Intersection of Three Sorted Arrays,78.9%,Easy,0.09643440701660581, https://leetcode.com/problems/intersection-of-three-sorted-arrays
73,Set Matrix Zeroes,43.1%,Medium,0.07912453490203865, https://leetcode.com/problems/set-matrix-zeroes
692,Top K Frequent Words,51.8%,Medium,0.06262915907044142, https://leetcode.com/problems/top-k-frequent-words
528,Random Pick with Weight,43.9%,Medium,0.056333090457586533, https://leetcode.com/problems/random-pick-with-weight
65,Valid Number,15.3%,Hard,0.04813763559815448, https://leetcode.com/problems/valid-number
206,Reverse Linked List,62.5%,Easy,0.03512406277610997, https://leetcode.com/problems/reverse-linked-list
98,Validate Binary Search Tree,27.8%,Medium,0.033861720512945864, https://leetcode.com/problems/validate-binary-search-tree
1002,Find Common Characters,67.7%,Easy,0.033176651317732786, https://leetcode.com/problems/find-common-characters
33,Search in Rotated Sorted Array,34.5%,Medium,0.019219533793635182, https://leetcode.com/problems/search-in-rotated-sorted-array
384,Shuffle an Array,52.8%,Medium,0.014706147389695468, https://leetcode.com/problems/shuffle-an-array
101,Symmetric Tree,46.8%,Easy,0.013003027580387157, https://leetcode.com/problems/symmetric-tree
70,Climbing Stairs,47.8%,Easy,0.005888214855949732, https://leetcode.com/problems/climbing-stairs
139,Word Break,40.1%,Medium,0.003755167762323698, https://leetcode.com/problems/word-break
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
274,H-Index,36.1%,Medium,0.18810197835269699, https://leetcode.com/problems/h-index
146,LRU Cache,33.2%,Medium,0.14642426807449366, https://leetcode.com/problems/lru-cache
149,Max Points on a Line,16.9%,Hard,0.13811211729480913, https://leetcode.com/problems/max-points-on-a-line
1213,Intersection of Three Sorted Arrays,78.9%,Easy,0.09643440701660581, https://leetcode.com/problems/intersection-of-three-sorted-arrays
73,Set Matrix Zeroes,43.1%,Medium,0.07912453490203865, https://leetcode.com/problems/set-matrix-zeroes
692,Top K Frequent Words,51.8%,Medium,0.06262915907044142, https://leetcode.com/problems/top-k-frequent-words
528,Random Pick with Weight,43.9%,Medium,0.056333090457586533, https://leetcode.com/problems/random-pick-with-weight
65,Valid Number,15.3%,Hard,0.04813763559815448, https://leetcode.com/problems/valid-number
206,Reverse Linked List,62.5%,Easy,0.03512406277610997, https://leetcode.com/problems/reverse-linked-list
98,Validate Binary Search Tree,27.8%,Medium,0.033861720512945864, https://leetcode.com/problems/validate-binary-search-tree
1002,Find Common Characters,67.7%,Easy,0.033176651317732786, https://leetcode.com/problems/find-common-characters
33,Search in Rotated Sorted Array,34.5%,Medium,0.019219533793635182, https://leetcode.com/problems/search-in-rotated-sorted-array
384,Shuffle an Array,52.8%,Medium,0.014706147389695468, https://leetcode.com/problems/shuffle-an-array
101,Symmetric Tree,46.8%,Easy,0.013003027580387157, https://leetcode.com/problems/symmetric-tree
70,Climbing Stairs,47.8%,Easy,0.005888214855949732, https://leetcode.com/problems/climbing-stairs
139,Word Break,40.1%,Medium,0.003755167762323698, https://leetcode.com/problems/word-break
1 274 ID H-Index Title 36.1% Acceptance Medium Difficulty 0.18810197835269699 Frequency https://leetcode.com/problems/h-index Leetcode Question Link
2 146 274 LRU Cache H-Index 33.2% 36.1% Medium Medium 0.14642426807449366 0.18810197835269699 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/h-index
3 149 146 Max Points on a Line LRU Cache 16.9% 33.2% Hard Medium 0.13811211729480913 0.14642426807449366 https://leetcode.com/problems/max-points-on-a-line https://leetcode.com/problems/lru-cache
4 1213 149 Intersection of Three Sorted Arrays Max Points on a Line 78.9% 16.9% Easy Hard 0.09643440701660581 0.13811211729480913 https://leetcode.com/problems/intersection-of-three-sorted-arrays https://leetcode.com/problems/max-points-on-a-line
5 73 1213 Set Matrix Zeroes Intersection of Three Sorted Arrays 43.1% 78.9% Medium Easy 0.07912453490203865 0.09643440701660581 https://leetcode.com/problems/set-matrix-zeroes https://leetcode.com/problems/intersection-of-three-sorted-arrays
6 692 73 Top K Frequent Words Set Matrix Zeroes 51.8% 43.1% Medium Medium 0.06262915907044142 0.07912453490203865 https://leetcode.com/problems/top-k-frequent-words https://leetcode.com/problems/set-matrix-zeroes
7 528 692 Random Pick with Weight Top K Frequent Words 43.9% 51.8% Medium Medium 0.056333090457586533 0.06262915907044142 https://leetcode.com/problems/random-pick-with-weight https://leetcode.com/problems/top-k-frequent-words
8 65 528 Valid Number Random Pick with Weight 15.3% 43.9% Hard Medium 0.04813763559815448 0.056333090457586533 https://leetcode.com/problems/valid-number https://leetcode.com/problems/random-pick-with-weight
9 206 65 Reverse Linked List Valid Number 62.5% 15.3% Easy Hard 0.03512406277610997 0.04813763559815448 https://leetcode.com/problems/reverse-linked-list https://leetcode.com/problems/valid-number
10 98 206 Validate Binary Search Tree Reverse Linked List 27.8% 62.5% Medium Easy 0.033861720512945864 0.03512406277610997 https://leetcode.com/problems/validate-binary-search-tree https://leetcode.com/problems/reverse-linked-list
11 1002 98 Find Common Characters Validate Binary Search Tree 67.7% 27.8% Easy Medium 0.033176651317732786 0.033861720512945864 https://leetcode.com/problems/find-common-characters https://leetcode.com/problems/validate-binary-search-tree
12 33 1002 Search in Rotated Sorted Array Find Common Characters 34.5% 67.7% Medium Easy 0.019219533793635182 0.033176651317732786 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/find-common-characters
13 384 33 Shuffle an Array Search in Rotated Sorted Array 52.8% 34.5% Medium Medium 0.014706147389695468 0.019219533793635182 https://leetcode.com/problems/shuffle-an-array https://leetcode.com/problems/search-in-rotated-sorted-array
14 101 384 Symmetric Tree Shuffle an Array 46.8% 52.8% Easy Medium 0.013003027580387157 0.014706147389695468 https://leetcode.com/problems/symmetric-tree https://leetcode.com/problems/shuffle-an-array
15 70 101 Climbing Stairs Symmetric Tree 47.8% 46.8% Easy Easy 0.005888214855949732 0.013003027580387157 https://leetcode.com/problems/climbing-stairs https://leetcode.com/problems/symmetric-tree
16 139 70 Word Break Climbing Stairs 40.1% 47.8% Medium Easy 0.003755167762323698 0.005888214855949732 https://leetcode.com/problems/word-break https://leetcode.com/problems/climbing-stairs
17 139 Word Break 40.1% Medium 0.003755167762323698 https://leetcode.com/problems/word-break