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,21 +1,22 @@
755,Pour Water,43.3%,Medium,1.6549959634129805, https://leetcode.com/problems/pour-water
1166,Design File System,56.8%,Medium,1.578042968988746, https://leetcode.com/problems/design-file-system
336,Palindrome Pairs,33.7%,Hard,1.3086247857193076, https://leetcode.com/problems/palindrome-pairs
166,Fraction to Recurring Decimal,21.6%,Medium,1.110416810228655, https://leetcode.com/problems/fraction-to-recurring-decimal
875,Koko Eating Bananas,52.1%,Medium,0.8409986269592165, https://leetcode.com/problems/koko-eating-bananas
773,Sliding Puzzle,59.3%,Hard,0.6810258200276005, https://leetcode.com/problems/sliding-puzzle
864,Shortest Path to Get All Keys,40.1%,Hard,0.6061358035703156, https://leetcode.com/problems/shortest-path-to-get-all-keys
787,Cheapest Flights Within K Stops,39.3%,Medium,0.5212226928497461, https://leetcode.com/problems/cheapest-flights-within-k-stops
269,Alien Dictionary,33.3%,Hard,0.48723106280473205, https://leetcode.com/problems/alien-dictionary
251,Flatten 2D Vector,45.7%,Medium,0.4808790962829651, https://leetcode.com/problems/flatten-2d-vector
1257,Smallest Common Region,58.8%,Medium,0.2561688067457042, https://leetcode.com/problems/smallest-common-region
68,Text Justification,27.7%,Hard,0.16143214434637243, https://leetcode.com/problems/text-justification
1235,Maximum Profit in Job Scheduling,44.0%,Hard,0.1532629744871177, https://leetcode.com/problems/maximum-profit-in-job-scheduling
39,Combination Sum,56.1%,Medium,0.1339254107186325, https://leetcode.com/problems/combination-sum
324,Wiggle Sort II,29.9%,Medium,0.11122563511022437, https://leetcode.com/problems/wiggle-sort-ii
759,Employee Free Time,66.2%,Hard,0.10623186692973738, https://leetcode.com/problems/employee-free-time
280,Wiggle Sort,63.8%,Medium,0.04362742017962607, https://leetcode.com/problems/wiggle-sort
322,Coin Change,35.5%,Medium,0.024924029676386045, https://leetcode.com/problems/coin-change
341,Flatten Nested List Iterator,52.9%,Medium,0.019980684690483426, https://leetcode.com/problems/flatten-nested-list-iterator
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.004714210262726446, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
755,Pour Water,43.3%,Medium,1.6549959634129805, https://leetcode.com/problems/pour-water
1166,Design File System,56.8%,Medium,1.578042968988746, https://leetcode.com/problems/design-file-system
336,Palindrome Pairs,33.7%,Hard,1.3086247857193076, https://leetcode.com/problems/palindrome-pairs
166,Fraction to Recurring Decimal,21.6%,Medium,1.110416810228655, https://leetcode.com/problems/fraction-to-recurring-decimal
875,Koko Eating Bananas,52.1%,Medium,0.8409986269592165, https://leetcode.com/problems/koko-eating-bananas
773,Sliding Puzzle,59.3%,Hard,0.6810258200276005, https://leetcode.com/problems/sliding-puzzle
864,Shortest Path to Get All Keys,40.1%,Hard,0.6061358035703156, https://leetcode.com/problems/shortest-path-to-get-all-keys
787,Cheapest Flights Within K Stops,39.3%,Medium,0.5212226928497461, https://leetcode.com/problems/cheapest-flights-within-k-stops
269,Alien Dictionary,33.3%,Hard,0.48723106280473205, https://leetcode.com/problems/alien-dictionary
251,Flatten 2D Vector,45.7%,Medium,0.4808790962829651, https://leetcode.com/problems/flatten-2d-vector
1257,Smallest Common Region,58.8%,Medium,0.2561688067457042, https://leetcode.com/problems/smallest-common-region
68,Text Justification,27.7%,Hard,0.16143214434637243, https://leetcode.com/problems/text-justification
1235,Maximum Profit in Job Scheduling,44.0%,Hard,0.1532629744871177, https://leetcode.com/problems/maximum-profit-in-job-scheduling
39,Combination Sum,56.1%,Medium,0.1339254107186325, https://leetcode.com/problems/combination-sum
324,Wiggle Sort II,29.9%,Medium,0.11122563511022437, https://leetcode.com/problems/wiggle-sort-ii
759,Employee Free Time,66.2%,Hard,0.10623186692973738, https://leetcode.com/problems/employee-free-time
280,Wiggle Sort,63.8%,Medium,0.04362742017962607, https://leetcode.com/problems/wiggle-sort
322,Coin Change,35.5%,Medium,0.024924029676386045, https://leetcode.com/problems/coin-change
341,Flatten Nested List Iterator,52.9%,Medium,0.019980684690483426, https://leetcode.com/problems/flatten-nested-list-iterator
236,Lowest Common Ancestor of a Binary Tree,45.7%,Medium,0.004714210262726446, https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
42,Trapping Rain Water,48.9%,Hard,0.004350670338744988, https://leetcode.com/problems/trapping-rain-water
1 755 ID Pour Water Title 43.3% Acceptance Medium Difficulty 1.6549959634129805 Frequency https://leetcode.com/problems/pour-water Leetcode Question Link
2 1166 755 Design File System Pour Water 56.8% 43.3% Medium Medium 1.578042968988746 1.6549959634129805 https://leetcode.com/problems/design-file-system https://leetcode.com/problems/pour-water
3 336 1166 Palindrome Pairs Design File System 33.7% 56.8% Hard Medium 1.3086247857193076 1.578042968988746 https://leetcode.com/problems/palindrome-pairs https://leetcode.com/problems/design-file-system
4 166 336 Fraction to Recurring Decimal Palindrome Pairs 21.6% 33.7% Medium Hard 1.110416810228655 1.3086247857193076 https://leetcode.com/problems/fraction-to-recurring-decimal https://leetcode.com/problems/palindrome-pairs
5 875 166 Koko Eating Bananas Fraction to Recurring Decimal 52.1% 21.6% Medium Medium 0.8409986269592165 1.110416810228655 https://leetcode.com/problems/koko-eating-bananas https://leetcode.com/problems/fraction-to-recurring-decimal
6 773 875 Sliding Puzzle Koko Eating Bananas 59.3% 52.1% Hard Medium 0.6810258200276005 0.8409986269592165 https://leetcode.com/problems/sliding-puzzle https://leetcode.com/problems/koko-eating-bananas
7 864 773 Shortest Path to Get All Keys Sliding Puzzle 40.1% 59.3% Hard Hard 0.6061358035703156 0.6810258200276005 https://leetcode.com/problems/shortest-path-to-get-all-keys https://leetcode.com/problems/sliding-puzzle
8 787 864 Cheapest Flights Within K Stops Shortest Path to Get All Keys 39.3% 40.1% Medium Hard 0.5212226928497461 0.6061358035703156 https://leetcode.com/problems/cheapest-flights-within-k-stops https://leetcode.com/problems/shortest-path-to-get-all-keys
9 269 787 Alien Dictionary Cheapest Flights Within K Stops 33.3% 39.3% Hard Medium 0.48723106280473205 0.5212226928497461 https://leetcode.com/problems/alien-dictionary https://leetcode.com/problems/cheapest-flights-within-k-stops
10 251 269 Flatten 2D Vector Alien Dictionary 45.7% 33.3% Medium Hard 0.4808790962829651 0.48723106280473205 https://leetcode.com/problems/flatten-2d-vector https://leetcode.com/problems/alien-dictionary
11 1257 251 Smallest Common Region Flatten 2D Vector 58.8% 45.7% Medium Medium 0.2561688067457042 0.4808790962829651 https://leetcode.com/problems/smallest-common-region https://leetcode.com/problems/flatten-2d-vector
12 68 1257 Text Justification Smallest Common Region 27.7% 58.8% Hard Medium 0.16143214434637243 0.2561688067457042 https://leetcode.com/problems/text-justification https://leetcode.com/problems/smallest-common-region
13 1235 68 Maximum Profit in Job Scheduling Text Justification 44.0% 27.7% Hard Hard 0.1532629744871177 0.16143214434637243 https://leetcode.com/problems/maximum-profit-in-job-scheduling https://leetcode.com/problems/text-justification
14 39 1235 Combination Sum Maximum Profit in Job Scheduling 56.1% 44.0% Medium Hard 0.1339254107186325 0.1532629744871177 https://leetcode.com/problems/combination-sum https://leetcode.com/problems/maximum-profit-in-job-scheduling
15 324 39 Wiggle Sort II Combination Sum 29.9% 56.1% Medium Medium 0.11122563511022437 0.1339254107186325 https://leetcode.com/problems/wiggle-sort-ii https://leetcode.com/problems/combination-sum
16 759 324 Employee Free Time Wiggle Sort II 66.2% 29.9% Hard Medium 0.10623186692973738 0.11122563511022437 https://leetcode.com/problems/employee-free-time https://leetcode.com/problems/wiggle-sort-ii
17 280 759 Wiggle Sort Employee Free Time 63.8% 66.2% Medium Hard 0.04362742017962607 0.10623186692973738 https://leetcode.com/problems/wiggle-sort https://leetcode.com/problems/employee-free-time
18 322 280 Coin Change Wiggle Sort 35.5% 63.8% Medium Medium 0.024924029676386045 0.04362742017962607 https://leetcode.com/problems/coin-change https://leetcode.com/problems/wiggle-sort
19 341 322 Flatten Nested List Iterator Coin Change 52.9% 35.5% Medium Medium 0.019980684690483426 0.024924029676386045 https://leetcode.com/problems/flatten-nested-list-iterator https://leetcode.com/problems/coin-change
20 236 341 Lowest Common Ancestor of a Binary Tree Flatten Nested List Iterator 45.7% 52.9% Medium Medium 0.004714210262726446 0.019980684690483426 https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree https://leetcode.com/problems/flatten-nested-list-iterator
21 42 236 Trapping Rain Water Lowest Common Ancestor of a Binary Tree 48.9% 45.7% Hard Medium 0.004350670338744988 0.004714210262726446 https://leetcode.com/problems/trapping-rain-water https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
22 42 Trapping Rain Water 48.9% Hard 0.004350670338744988 https://leetcode.com/problems/trapping-rain-water