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,10 +1,11 @@
939,Minimum Area Rectangle,51.8%,Medium,0.03323242792566654, https://leetcode.com/problems/minimum-area-rectangle
231,Power of Two,43.7%,Easy,0.021776810232970734, https://leetcode.com/problems/power-of-two
146,LRU Cache,33.2%,Medium,0.010321192540274932, https://leetcode.com/problems/lru-cache
206,Reverse Linked List,62.5%,Easy,0.009326794511974934, https://leetcode.com/problems/reverse-linked-list
114,Flatten Binary Tree to Linked List,49.3%,Medium,0.006896579059060353, https://leetcode.com/problems/flatten-binary-tree-to-linked-list
199,Binary Tree Right Side View,54.1%,Medium,0.0056826406650506926, https://leetcode.com/problems/binary-tree-right-side-view
22,Generate Parentheses,62.7%,Medium,0.0043611059090124735, https://leetcode.com/problems/generate-parentheses
23,Merge k Sorted Lists,40.2%,Hard,0.004051459000748015, https://leetcode.com/problems/merge-k-sorted-lists
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
33,Search in Rotated Sorted Array,34.5%,Medium,0.003229976968332634, https://leetcode.com/problems/search-in-rotated-sorted-array
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
939,Minimum Area Rectangle,51.8%,Medium,0.03323242792566654, https://leetcode.com/problems/minimum-area-rectangle
231,Power of Two,43.7%,Easy,0.021776810232970734, https://leetcode.com/problems/power-of-two
146,LRU Cache,33.2%,Medium,0.010321192540274932, https://leetcode.com/problems/lru-cache
206,Reverse Linked List,62.5%,Easy,0.009326794511974934, https://leetcode.com/problems/reverse-linked-list
114,Flatten Binary Tree to Linked List,49.3%,Medium,0.006896579059060353, https://leetcode.com/problems/flatten-binary-tree-to-linked-list
199,Binary Tree Right Side View,54.1%,Medium,0.0056826406650506926, https://leetcode.com/problems/binary-tree-right-side-view
22,Generate Parentheses,62.7%,Medium,0.0043611059090124735, https://leetcode.com/problems/generate-parentheses
23,Merge k Sorted Lists,40.2%,Hard,0.004051459000748015, https://leetcode.com/problems/merge-k-sorted-lists
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
33,Search in Rotated Sorted Array,34.5%,Medium,0.003229976968332634, https://leetcode.com/problems/search-in-rotated-sorted-array
1 939 ID Minimum Area Rectangle Title 51.8% Acceptance Medium Difficulty 0.03323242792566654 Frequency https://leetcode.com/problems/minimum-area-rectangle Leetcode Question Link
2 231 939 Power of Two Minimum Area Rectangle 43.7% 51.8% Easy Medium 0.021776810232970734 0.03323242792566654 https://leetcode.com/problems/power-of-two https://leetcode.com/problems/minimum-area-rectangle
3 146 231 LRU Cache Power of Two 33.2% 43.7% Medium Easy 0.010321192540274932 0.021776810232970734 https://leetcode.com/problems/lru-cache https://leetcode.com/problems/power-of-two
4 206 146 Reverse Linked List LRU Cache 62.5% 33.2% Easy Medium 0.009326794511974934 0.010321192540274932 https://leetcode.com/problems/reverse-linked-list https://leetcode.com/problems/lru-cache
5 114 206 Flatten Binary Tree to Linked List Reverse Linked List 49.3% 62.5% Medium Easy 0.006896579059060353 0.009326794511974934 https://leetcode.com/problems/flatten-binary-tree-to-linked-list https://leetcode.com/problems/reverse-linked-list
6 199 114 Binary Tree Right Side View Flatten Binary Tree to Linked List 54.1% 49.3% Medium Medium 0.0056826406650506926 0.006896579059060353 https://leetcode.com/problems/binary-tree-right-side-view https://leetcode.com/problems/flatten-binary-tree-to-linked-list
7 22 199 Generate Parentheses Binary Tree Right Side View 62.7% 54.1% Medium Medium 0.0043611059090124735 0.0056826406650506926 https://leetcode.com/problems/generate-parentheses https://leetcode.com/problems/binary-tree-right-side-view
8 23 22 Merge k Sorted Lists Generate Parentheses 40.2% 62.7% Hard Medium 0.004051459000748015 0.0043611059090124735 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/generate-parentheses
9 1 23 Two Sum Merge k Sorted Lists 45.6% 40.2% Easy Hard 0.003278422738041615 0.004051459000748015 https://leetcode.com/problems/two-sum https://leetcode.com/problems/merge-k-sorted-lists
10 33 1 Search in Rotated Sorted Array Two Sum 34.5% 45.6% Medium Easy 0.003229976968332634 0.003278422738041615 https://leetcode.com/problems/search-in-rotated-sorted-array https://leetcode.com/problems/two-sum
11 33 Search in Rotated Sorted Array 34.5% Medium 0.003229976968332634 https://leetcode.com/problems/search-in-rotated-sorted-array