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 @@
206,Reverse Linked List,62.5%,Easy,0.13873591368953625, https://leetcode.com/problems/reverse-linked-list
33,Search in Rotated Sorted Array,34.5%,Medium,0.1101693809658871, https://leetcode.com/problems/search-in-rotated-sorted-array
223,Rectangle Area,37.8%,Medium,0.10064352577968744, https://leetcode.com/problems/rectangle-area
146,LRU Cache,33.2%,Medium,0.08926627755405464, https://leetcode.com/problems/lru-cache
48,Rotate Image,56.7%,Medium,0.06069974483040549, https://leetcode.com/problems/rotate-image
231,Power of Two,43.7%,Easy,0.059357559503279325, https://leetcode.com/problems/power-of-two
200,Number of Islands,46.8%,Medium,0.05694938541936198, https://leetcode.com/problems/number-of-islands
706,Design HashMap,61.3%,Easy,0.039016652342451774, https://leetcode.com/problems/design-hashmap
939,Minimum Area Rectangle,51.8%,Medium,0.03802739558923925, https://leetcode.com/problems/minimum-area-rectangle
199,Binary Tree Right Side View,54.1%,Medium,0.034997972754213943, https://leetcode.com/problems/binary-tree-right-side-view
1,Two Sum,45.6%,Easy,0.03409719244428431, https://leetcode.com/problems/two-sum
70,Climbing Stairs,47.8%,Easy,0.03011156054328408, https://leetcode.com/problems/climbing-stairs
64,Minimum Path Sum,54.5%,Medium,0.024287775531756203, https://leetcode.com/problems/minimum-path-sum
2,Add Two Numbers,33.9%,Medium,0.020491663368639005, https://leetcode.com/problems/add-two-numbers
97,Interleaving String,31.5%,Hard,0.020471543980187256, https://leetcode.com/problems/interleaving-string
53,Maximum Subarray,46.5%,Easy,0.019336728821707075, https://leetcode.com/problems/maximum-subarray
22,Generate Parentheses,62.7%,Medium,0.017331456351639924, https://leetcode.com/problems/generate-parentheses
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
114,Flatten Binary Tree to Linked List,49.3%,Medium,0.015450951155718977, https://leetcode.com/problems/flatten-binary-tree-to-linked-list
8,String to Integer (atoi),15.4%,Medium,0.015084664273571906, https://leetcode.com/problems/string-to-integer-atoi
151,Reverse Words in a String,21.9%,Medium,0.013753273019471011, https://leetcode.com/problems/reverse-words-in-a-string
739,Daily Temperatures,63.3%,Medium,0.010032690121814417, https://leetcode.com/problems/daily-temperatures
415,Add Strings,47.5%,Easy,0.007587289812159497, https://leetcode.com/problems/add-strings
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
206,Reverse Linked List,62.5%,Easy,0.13873591368953625, https://leetcode.com/problems/reverse-linked-list
33,Search in Rotated Sorted Array,34.5%,Medium,0.1101693809658871, https://leetcode.com/problems/search-in-rotated-sorted-array
223,Rectangle Area,37.8%,Medium,0.10064352577968744, https://leetcode.com/problems/rectangle-area
146,LRU Cache,33.2%,Medium,0.08926627755405464, https://leetcode.com/problems/lru-cache
48,Rotate Image,56.7%,Medium,0.06069974483040549, https://leetcode.com/problems/rotate-image
231,Power of Two,43.7%,Easy,0.059357559503279325, https://leetcode.com/problems/power-of-two
200,Number of Islands,46.8%,Medium,0.05694938541936198, https://leetcode.com/problems/number-of-islands
706,Design HashMap,61.3%,Easy,0.039016652342451774, https://leetcode.com/problems/design-hashmap
939,Minimum Area Rectangle,51.8%,Medium,0.03802739558923925, https://leetcode.com/problems/minimum-area-rectangle
199,Binary Tree Right Side View,54.1%,Medium,0.034997972754213943, https://leetcode.com/problems/binary-tree-right-side-view
1,Two Sum,45.6%,Easy,0.03409719244428431, https://leetcode.com/problems/two-sum
70,Climbing Stairs,47.8%,Easy,0.03011156054328408, https://leetcode.com/problems/climbing-stairs
64,Minimum Path Sum,54.5%,Medium,0.024287775531756203, https://leetcode.com/problems/minimum-path-sum
2,Add Two Numbers,33.9%,Medium,0.020491663368639005, https://leetcode.com/problems/add-two-numbers
97,Interleaving String,31.5%,Hard,0.020471543980187256, https://leetcode.com/problems/interleaving-string
53,Maximum Subarray,46.5%,Easy,0.019336728821707075, https://leetcode.com/problems/maximum-subarray
22,Generate Parentheses,62.7%,Medium,0.017331456351639924, https://leetcode.com/problems/generate-parentheses
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
114,Flatten Binary Tree to Linked List,49.3%,Medium,0.015450951155718977, https://leetcode.com/problems/flatten-binary-tree-to-linked-list
8,String to Integer (atoi),15.4%,Medium,0.015084664273571906, https://leetcode.com/problems/string-to-integer-atoi
151,Reverse Words in a String,21.9%,Medium,0.013753273019471011, https://leetcode.com/problems/reverse-words-in-a-string
739,Daily Temperatures,63.3%,Medium,0.010032690121814417, https://leetcode.com/problems/daily-temperatures
415,Add Strings,47.5%,Easy,0.007587289812159497, https://leetcode.com/problems/add-strings
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
1 206 ID Reverse Linked List Title 62.5% Acceptance Easy Difficulty 0.13873591368953625 Frequency https://leetcode.com/problems/reverse-linked-list Leetcode Question Link
2 33 206 Search in Rotated Sorted Array Reverse Linked List 34.5% 62.5% Medium Easy 0.1101693809658871 0.13873591368953625 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/reverse-linked-list
3 223 33 Rectangle Area Search in Rotated Sorted Array 37.8% 34.5% Medium Medium 0.10064352577968744 0.1101693809658871 https://leetcode.com/problems/rectangle-area https://leetcode.com/problems/search-in-rotated-sorted-array
4 146 223 LRU Cache Rectangle Area 33.2% 37.8% Medium Medium 0.08926627755405464 0.10064352577968744 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/rectangle-area
5 48 146 Rotate Image LRU Cache 56.7% 33.2% Medium Medium 0.06069974483040549 0.08926627755405464 https://leetcode.com/problems/rotate-image https://leetcode.com/problems/lru-cache
6 231 48 Power of Two Rotate Image 43.7% 56.7% Easy Medium 0.059357559503279325 0.06069974483040549 https://leetcode.com/problems/power-of-two https://leetcode.com/problems/rotate-image
7 200 231 Number of Islands Power of Two 46.8% 43.7% Medium Easy 0.05694938541936198 0.059357559503279325 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/power-of-two
8 706 200 Design HashMap Number of Islands 61.3% 46.8% Easy Medium 0.039016652342451774 0.05694938541936198 https://leetcode.com/problems/design-hashmap https://leetcode.com/problems/number-of-islands
9 939 706 Minimum Area Rectangle Design HashMap 51.8% 61.3% Medium Easy 0.03802739558923925 0.039016652342451774 https://leetcode.com/problems/minimum-area-rectangle https://leetcode.com/problems/design-hashmap
10 199 939 Binary Tree Right Side View Minimum Area Rectangle 54.1% 51.8% Medium Medium 0.034997972754213943 0.03802739558923925 https://leetcode.com/problems/binary-tree-right-side-view https://leetcode.com/problems/minimum-area-rectangle
11 1 199 Two Sum Binary Tree Right Side View 45.6% 54.1% Easy Medium 0.03409719244428431 0.034997972754213943 https://leetcode.com/problems/two-sum https://leetcode.com/problems/binary-tree-right-side-view
12 70 1 Climbing Stairs Two Sum 47.8% 45.6% Easy Easy 0.03011156054328408 0.03409719244428431 https://leetcode.com/problems/climbing-stairs https://leetcode.com/problems/two-sum
13 64 70 Minimum Path Sum Climbing Stairs 54.5% 47.8% Medium Easy 0.024287775531756203 0.03011156054328408 https://leetcode.com/problems/minimum-path-sum https://leetcode.com/problems/climbing-stairs
14 2 64 Add Two Numbers Minimum Path Sum 33.9% 54.5% Medium Medium 0.020491663368639005 0.024287775531756203 https://leetcode.com/problems/add-two-numbers https://leetcode.com/problems/minimum-path-sum
15 97 2 Interleaving String Add Two Numbers 31.5% 33.9% Hard Medium 0.020471543980187256 0.020491663368639005 https://leetcode.com/problems/interleaving-string https://leetcode.com/problems/add-two-numbers
16 53 97 Maximum Subarray Interleaving String 46.5% 31.5% Easy Hard 0.019336728821707075 0.020471543980187256 https://leetcode.com/problems/maximum-subarray https://leetcode.com/problems/interleaving-string
17 22 53 Generate Parentheses Maximum Subarray 62.7% 46.5% Medium Easy 0.017331456351639924 0.019336728821707075 https://leetcode.com/problems/generate-parentheses https://leetcode.com/problems/maximum-subarray
18 23 22 Merge k Sorted Lists Generate Parentheses 40.2% 62.7% Hard Medium 0.016108271385328228 0.017331456351639924 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/generate-parentheses
19 114 23 Flatten Binary Tree to Linked List Merge k Sorted Lists 49.3% 40.2% Medium Hard 0.015450951155718977 0.016108271385328228 https://leetcode.com/problems/flatten-binary-tree-to-linked-list https://leetcode.com/problems/merge-k-sorted-lists
20 8 114 String to Integer (atoi) Flatten Binary Tree to Linked List 15.4% 49.3% Medium Medium 0.015084664273571906 0.015450951155718977 https://leetcode.com/problems/string-to-integer-atoi https://leetcode.com/problems/flatten-binary-tree-to-linked-list
21 151 8 Reverse Words in a String String to Integer (atoi) 21.9% 15.4% Medium Medium 0.013753273019471011 0.015084664273571906 https://leetcode.com/problems/reverse-words-in-a-string https://leetcode.com/problems/string-to-integer-atoi
22 739 151 Daily Temperatures Reverse Words in a String 63.3% 21.9% Medium Medium 0.010032690121814417 0.013753273019471011 https://leetcode.com/problems/daily-temperatures https://leetcode.com/problems/reverse-words-in-a-string
23 415 739 Add Strings Daily Temperatures 47.5% 63.3% Easy Medium 0.007587289812159497 0.010032690121814417 https://leetcode.com/problems/add-strings https://leetcode.com/problems/daily-temperatures
24 42 415 Trapping Rain Water Add Strings 48.9% 47.5% Hard Easy 0.004350670338744988 0.007587289812159497 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/add-strings
25 42 Trapping Rain Water 48.9% Hard 0.004350670338744988 https://leetcode.com/problems/trapping-rain-water