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,14 +1,15 @@
761,Special Binary String,54.7%,Hard,0.09348775380846833, https://leetcode.com/problems/special-binary-string
362,Design Hit Counter,63.7%,Medium,0.05622967649867821, https://leetcode.com/problems/design-hit-counter
1353,Maximum Number of Events That Can Be Attended,30.5%,Medium,0.05428741283782842, https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended
42,Trapping Rain Water,48.9%,Hard,0.05203424501747888, https://leetcode.com/problems/trapping-rain-water
54,Spiral Matrix,34.1%,Medium,0.014776167707688753, https://leetcode.com/problems/spiral-matrix
76,Minimum Window Substring,34.6%,Hard,0.013966707481708198, https://leetcode.com/problems/minimum-window-substring
380,Insert Delete GetRandom O(1),47.5%,Medium,0.009820849864094454, https://leetcode.com/problems/insert-delete-getrandom-o1
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
98,Validate Binary Search Tree,27.8%,Medium,0.006611351489350257, https://leetcode.com/problems/validate-binary-search-tree
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0047725193990346675, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
206,Reverse Linked List,62.5%,Easy,0.0023398665252948926, https://leetcode.com/problems/reverse-linked-list
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
761,Special Binary String,54.7%,Hard,0.09348775380846833, https://leetcode.com/problems/special-binary-string
362,Design Hit Counter,63.7%,Medium,0.05622967649867821, https://leetcode.com/problems/design-hit-counter
1353,Maximum Number of Events That Can Be Attended,30.5%,Medium,0.05428741283782842, https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended
42,Trapping Rain Water,48.9%,Hard,0.05203424501747888, https://leetcode.com/problems/trapping-rain-water
54,Spiral Matrix,34.1%,Medium,0.014776167707688753, https://leetcode.com/problems/spiral-matrix
76,Minimum Window Substring,34.6%,Hard,0.013966707481708198, https://leetcode.com/problems/minimum-window-substring
380,Insert Delete GetRandom O(1),47.5%,Medium,0.009820849864094454, https://leetcode.com/problems/insert-delete-getrandom-o1
253,Meeting Rooms II,45.7%,Medium,0.008079219870546493, https://leetcode.com/problems/meeting-rooms-ii
98,Validate Binary Search Tree,27.8%,Medium,0.006611351489350257, https://leetcode.com/problems/validate-binary-search-tree
15,3Sum,26.8%,Medium,0.004940992758742591, https://leetcode.com/problems/3sum
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.0047725193990346675, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
1,Two Sum,45.6%,Easy,0.003278422738041615, https://leetcode.com/problems/two-sum
206,Reverse Linked List,62.5%,Easy,0.0023398665252948926, https://leetcode.com/problems/reverse-linked-list
20,Valid Parentheses,39.0%,Easy,0.0023005704055949323, https://leetcode.com/problems/valid-parentheses
1 761 ID Special Binary String Title 54.7% Acceptance Hard Difficulty 0.09348775380846833 Frequency https://leetcode.com/problems/special-binary-string Leetcode Question Link
2 362 761 Design Hit Counter Special Binary String 63.7% 54.7% Medium Hard 0.05622967649867821 0.09348775380846833 https://leetcode.com/problems/design-hit-counter https://leetcode.com/problems/special-binary-string
3 1353 362 Maximum Number of Events That Can Be Attended Design Hit Counter 30.5% 63.7% Medium Medium 0.05428741283782842 0.05622967649867821 https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended https://leetcode.com/problems/design-hit-counter
4 42 1353 Trapping Rain Water Maximum Number of Events That Can Be Attended 48.9% 30.5% Hard Medium 0.05203424501747888 0.05428741283782842 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/maximum-number-of-events-that-can-be-attended
5 54 42 Spiral Matrix Trapping Rain Water 34.1% 48.9% Medium Hard 0.014776167707688753 0.05203424501747888 https://leetcode.com/problems/spiral-matrix https://leetcode.com/problems/trapping-rain-water
6 76 54 Minimum Window Substring Spiral Matrix 34.6% 34.1% Hard Medium 0.013966707481708198 0.014776167707688753 https://leetcode.com/problems/minimum-window-substring https://leetcode.com/problems/spiral-matrix
7 380 76 Insert Delete GetRandom O(1) Minimum Window Substring 47.5% 34.6% Medium Hard 0.009820849864094454 0.013966707481708198 https://leetcode.com/problems/insert-delete-getrandom-o1 https://leetcode.com/problems/minimum-window-substring
8 253 380 Meeting Rooms II Insert Delete GetRandom O(1) 45.7% 47.5% Medium Medium 0.008079219870546493 0.009820849864094454 https://leetcode.com/problems/meeting-rooms-ii https://leetcode.com/problems/insert-delete-getrandom-o1
9 98 253 Validate Binary Search Tree Meeting Rooms II 27.8% 45.7% Medium Medium 0.006611351489350257 0.008079219870546493 https://leetcode.com/problems/validate-binary-search-tree https://leetcode.com/problems/meeting-rooms-ii
10 15 98 3Sum Validate Binary Search Tree 26.8% 27.8% Medium Medium 0.004940992758742591 0.006611351489350257 https://leetcode.com/problems/3sum https://leetcode.com/problems/validate-binary-search-tree
11 121 15 Best Time to Buy and Sell Stock 3Sum 50.5% 26.8% Easy Medium 0.0047725193990346675 0.004940992758742591 https://leetcode.com/problems/best-time-to-buy-and-sell-stock https://leetcode.com/problems/3sum
12 1 121 Two Sum Best Time to Buy and Sell Stock 45.6% 50.5% Easy Easy 0.003278422738041615 0.0047725193990346675 https://leetcode.com/problems/two-sum https://leetcode.com/problems/best-time-to-buy-and-sell-stock
13 206 1 Reverse Linked List Two Sum 62.5% 45.6% Easy Easy 0.0023398665252948926 0.003278422738041615 https://leetcode.com/problems/reverse-linked-list https://leetcode.com/problems/two-sum
14 20 206 Valid Parentheses Reverse Linked List 39.0% 62.5% Easy Easy 0.0023005704055949323 0.0023398665252948926 https://leetcode.com/problems/valid-parentheses https://leetcode.com/problems/reverse-linked-list
15 20 Valid Parentheses 39.0% Easy 0.0023005704055949323 https://leetcode.com/problems/valid-parentheses