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,12 +1,13 @@
669,Trim a Binary Search Tree,63.0%,Easy,0.015052444911090134, https://leetcode.com/problems/trim-a-binary-search-tree
384,Shuffle an Array,52.8%,Medium,0.011375721700252122, https://leetcode.com/problems/shuffle-an-array
77,Combinations,54.7%,Medium,0.008578021081192079, https://leetcode.com/problems/combinations
1,Two Sum,45.6%,Easy,0.004901297870354067, https://leetcode.com/problems/two-sum
207,Course Schedule,43.1%,Medium,0.004736539346673217, https://leetcode.com/problems/course-schedule
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
13,Roman to Integer,55.7%,Easy,0.0032749333347487667, https://leetcode.com/problems/roman-to-integer
200,Number of Islands,46.8%,Medium,0.002765297303115152, https://leetcode.com/problems/number-of-islands
260,Single Number III,64.3%,Medium,0.002022143148991901, https://leetcode.com/problems/single-number-iii
7,Reverse Integer,25.8%,Easy,0.0017826905514433007, https://leetcode.com/problems/reverse-integer
2,Add Two Numbers,33.9%,Medium,0.0016196302686159038, https://leetcode.com/problems/add-two-numbers
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.0014852223137141987, https://leetcode.com/problems/longest-substring-without-repeating-characters
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
669,Trim a Binary Search Tree,63.0%,Easy,0.015052444911090134, https://leetcode.com/problems/trim-a-binary-search-tree
384,Shuffle an Array,52.8%,Medium,0.011375721700252122, https://leetcode.com/problems/shuffle-an-array
77,Combinations,54.7%,Medium,0.008578021081192079, https://leetcode.com/problems/combinations
1,Two Sum,45.6%,Easy,0.004901297870354067, https://leetcode.com/problems/two-sum
207,Course Schedule,43.1%,Medium,0.004736539346673217, https://leetcode.com/problems/course-schedule
42,Trapping Rain Water,48.9%,Hard,0.00411947029523883, https://leetcode.com/problems/trapping-rain-water
13,Roman to Integer,55.7%,Easy,0.0032749333347487667, https://leetcode.com/problems/roman-to-integer
200,Number of Islands,46.8%,Medium,0.002765297303115152, https://leetcode.com/problems/number-of-islands
260,Single Number III,64.3%,Medium,0.002022143148991901, https://leetcode.com/problems/single-number-iii
7,Reverse Integer,25.8%,Easy,0.0017826905514433007, https://leetcode.com/problems/reverse-integer
2,Add Two Numbers,33.9%,Medium,0.0016196302686159038, https://leetcode.com/problems/add-two-numbers
3,Longest Substring Without Repeating Characters,30.4%,Medium,0.0014852223137141987, https://leetcode.com/problems/longest-substring-without-repeating-characters
1 669 ID Trim a Binary Search Tree Title 63.0% Acceptance Easy Difficulty 0.015052444911090134 Frequency https://leetcode.com/problems/trim-a-binary-search-tree Leetcode Question Link
2 384 669 Shuffle an Array Trim a Binary Search Tree 52.8% 63.0% Medium Easy 0.011375721700252122 0.015052444911090134 https://leetcode.com/problems/shuffle-an-array https://leetcode.com/problems/trim-a-binary-search-tree
3 77 384 Combinations Shuffle an Array 54.7% 52.8% Medium Medium 0.008578021081192079 0.011375721700252122 https://leetcode.com/problems/combinations https://leetcode.com/problems/shuffle-an-array
4 1 77 Two Sum Combinations 45.6% 54.7% Easy Medium 0.004901297870354067 0.008578021081192079 https://leetcode.com/problems/two-sum https://leetcode.com/problems/combinations
5 207 1 Course Schedule Two Sum 43.1% 45.6% Medium Easy 0.004736539346673217 0.004901297870354067 https://leetcode.com/problems/course-schedule https://leetcode.com/problems/two-sum
6 42 207 Trapping Rain Water Course Schedule 48.9% 43.1% Hard Medium 0.00411947029523883 0.004736539346673217 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/course-schedule
7 13 42 Roman to Integer Trapping Rain Water 55.7% 48.9% Easy Hard 0.0032749333347487667 0.00411947029523883 https://leetcode.com/problems/roman-to-integer https://leetcode.com/problems/trapping-rain-water
8 200 13 Number of Islands Roman to Integer 46.8% 55.7% Medium Easy 0.002765297303115152 0.0032749333347487667 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/roman-to-integer
9 260 200 Single Number III Number of Islands 64.3% 46.8% Medium Medium 0.002022143148991901 0.002765297303115152 https://leetcode.com/problems/single-number-iii https://leetcode.com/problems/number-of-islands
10 7 260 Reverse Integer Single Number III 25.8% 64.3% Easy Medium 0.0017826905514433007 0.002022143148991901 https://leetcode.com/problems/reverse-integer https://leetcode.com/problems/single-number-iii
11 2 7 Add Two Numbers Reverse Integer 33.9% 25.8% Medium Easy 0.0016196302686159038 0.0017826905514433007 https://leetcode.com/problems/add-two-numbers https://leetcode.com/problems/reverse-integer
12 3 2 Longest Substring Without Repeating Characters Add Two Numbers 30.4% 33.9% Medium Medium 0.0014852223137141987 0.0016196302686159038 https://leetcode.com/problems/longest-substring-without-repeating-characters https://leetcode.com/problems/add-two-numbers
13 3 Longest Substring Without Repeating Characters 30.4% Medium 0.0014852223137141987 https://leetcode.com/problems/longest-substring-without-repeating-characters