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 @@
238,Product of Array Except Self,60.1%,Medium,0.1924592954490137, https://leetcode.com/problems/product-of-array-except-self
273,Integer to English Words,27.1%,Hard,0.1453851138462884, https://leetcode.com/problems/integer-to-english-words
51,N-Queens,46.6%,Hard,0.09831093224356313, https://leetcode.com/problems/n-queens
218,The Skyline Problem,34.6%,Hard,0.09823843958341322, https://leetcode.com/problems/the-skyline-problem
706,Design HashMap,61.3%,Easy,0.0683442674369718, https://leetcode.com/problems/design-hashmap
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.061960627359177074, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
227,Basic Calculator II,36.9%,Medium,0.027685557859864054, https://leetcode.com/problems/basic-calculator-ii
200,Number of Islands,46.8%,Medium,0.025712029212602353, https://leetcode.com/problems/number-of-islands
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.018954919107260947, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
57,Insert Interval,33.5%,Hard,0.013119243592498872, https://leetcode.com/problems/insert-interval
1,Two Sum,45.6%,Easy,0.013049691753224608, https://leetcode.com/problems/two-sum
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
88,Merge Sorted Array,39.4%,Easy,0.0030102370714243072, https://leetcode.com/problems/merge-sorted-array
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
238,Product of Array Except Self,60.1%,Medium,0.1924592954490137, https://leetcode.com/problems/product-of-array-except-self
273,Integer to English Words,27.1%,Hard,0.1453851138462884, https://leetcode.com/problems/integer-to-english-words
51,N-Queens,46.6%,Hard,0.09831093224356313, https://leetcode.com/problems/n-queens
218,The Skyline Problem,34.6%,Hard,0.09823843958341322, https://leetcode.com/problems/the-skyline-problem
706,Design HashMap,61.3%,Easy,0.0683442674369718, https://leetcode.com/problems/design-hashmap
297,Serialize and Deserialize Binary Tree,47.5%,Hard,0.061960627359177074, https://leetcode.com/problems/serialize-and-deserialize-binary-tree
227,Basic Calculator II,36.9%,Medium,0.027685557859864054, https://leetcode.com/problems/basic-calculator-ii
200,Number of Islands,46.8%,Medium,0.025712029212602353, https://leetcode.com/problems/number-of-islands
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.018954919107260947, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
23,Merge k Sorted Lists,40.2%,Hard,0.016108271385328228, https://leetcode.com/problems/merge-k-sorted-lists
57,Insert Interval,33.5%,Hard,0.013119243592498872, https://leetcode.com/problems/insert-interval
1,Two Sum,45.6%,Easy,0.013049691753224608, https://leetcode.com/problems/two-sum
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
88,Merge Sorted Array,39.4%,Easy,0.0030102370714243072, https://leetcode.com/problems/merge-sorted-array
1 238 ID Product of Array Except Self Title 60.1% Acceptance Medium Difficulty 0.1924592954490137 Frequency https://leetcode.com/problems/product-of-array-except-self Leetcode Question Link
2 273 238 Integer to English Words Product of Array Except Self 27.1% 60.1% Hard Medium 0.1453851138462884 0.1924592954490137 https://leetcode.com/problems/integer-to-english-words https://leetcode.com/problems/product-of-array-except-self
3 51 273 N-Queens Integer to English Words 46.6% 27.1% Hard Hard 0.09831093224356313 0.1453851138462884 https://leetcode.com/problems/n-queens https://leetcode.com/problems/integer-to-english-words
4 218 51 The Skyline Problem N-Queens 34.6% 46.6% Hard Hard 0.09823843958341322 0.09831093224356313 https://leetcode.com/problems/the-skyline-problem https://leetcode.com/problems/n-queens
5 706 218 Design HashMap The Skyline Problem 61.3% 34.6% Easy Hard 0.0683442674369718 0.09823843958341322 https://leetcode.com/problems/design-hashmap https://leetcode.com/problems/the-skyline-problem
6 297 706 Serialize and Deserialize Binary Tree Design HashMap 47.5% 61.3% Hard Easy 0.061960627359177074 0.0683442674369718 https://leetcode.com/problems/serialize-and-deserialize-binary-tree https://leetcode.com/problems/design-hashmap
7 227 297 Basic Calculator II Serialize and Deserialize Binary Tree 36.9% 47.5% Medium Hard 0.027685557859864054 0.061960627359177074 https://leetcode.com/problems/basic-calculator-ii https://leetcode.com/problems/serialize-and-deserialize-binary-tree
8 200 227 Number of Islands Basic Calculator II 46.8% 36.9% Medium Medium 0.025712029212602353 0.027685557859864054 https://leetcode.com/problems/number-of-islands https://leetcode.com/problems/basic-calculator-ii
9 121 200 Best Time to Buy and Sell Stock Number of Islands 50.5% 46.8% Easy Medium 0.018954919107260947 0.025712029212602353 https://leetcode.com/problems/best-time-to-buy-and-sell-stock https://leetcode.com/problems/number-of-islands
10 23 121 Merge k Sorted Lists Best Time to Buy and Sell Stock 40.2% 50.5% Hard Easy 0.016108271385328228 0.018954919107260947 https://leetcode.com/problems/merge-k-sorted-lists https://leetcode.com/problems/best-time-to-buy-and-sell-stock
11 57 23 Insert Interval Merge k Sorted Lists 33.5% 40.2% Hard Hard 0.013119243592498872 0.016108271385328228 https://leetcode.com/problems/insert-interval https://leetcode.com/problems/merge-k-sorted-lists
12 1 57 Two Sum Insert Interval 45.6% 33.5% Easy Hard 0.013049691753224608 0.013119243592498872 https://leetcode.com/problems/two-sum https://leetcode.com/problems/insert-interval
13 42 1 Trapping Rain Water Two Sum 48.9% 45.6% Hard Easy 0.004350670338744988 0.013049691753224608 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/two-sum
14 88 42 Merge Sorted Array Trapping Rain Water 39.4% 48.9% Easy Hard 0.0030102370714243072 0.004350670338744988 https://leetcode.com/problems/merge-sorted-array https://leetcode.com/problems/trapping-rain-water
15 88 Merge Sorted Array 39.4% Easy 0.0030102370714243072 https://leetcode.com/problems/merge-sorted-array