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