Files
LeetCode-Questions-CompanyWise/capital-one_alltime.csv
Krishna Kumar Dey fb5f78b55e 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)

```
2023-04-01 11:07:49 +05:30

1.8 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2228Summary Ranges39.5%Medium2.379243547602478https://leetcode.com/problems/summary-ranges
3814Binary Tree Pruning74.5%Medium1.714403093040326https://leetcode.com/problems/binary-tree-pruning
4328Odd Even Linked List55.7%Medium1.514446116622737https://leetcode.com/problems/odd-even-linked-list
5138Copy List with Random Pointer36.4%Medium1.3877294433016032https://leetcode.com/problems/copy-list-with-random-pointer
6290Word Pattern37.0%Easy1.3013067642290357https://leetcode.com/problems/word-pattern
72Add Two Numbers33.9%Medium1.2542105308123643https://leetcode.com/problems/add-two-numbers
8322Coin Change35.5%Medium1.0832857985041888https://leetcode.com/problems/coin-change
9412Fizz Buzz62.3%Easy0.41844534394203714https://leetcode.com/problems/fizz-buzz
101071Greatest Common Divisor of Strings52.9%Easy0.4175376893424336https://leetcode.com/problems/greatest-common-divisor-of-strings
11273Integer to English Words27.1%Hard0.26532833604818473https://leetcode.com/problems/integer-to-english-words
12204Count Primes31.5%Easy0.1633347782917643https://leetcode.com/problems/count-primes
1398Validate Binary Search Tree27.8%Medium0.07111326337575957https://leetcode.com/problems/validate-binary-search-tree
1453Maximum Subarray46.5%Easy0.052816160704876255https://leetcode.com/problems/maximum-subarray
1521Merge Two Sorted Lists53.5%Easy0.014012111332134735https://leetcode.com/problems/merge-two-sorted-lists
1666Plus One43.0%Easy0.007324847595025828https://leetcode.com/problems/plus-one
17203Remove Linked List Elements38.6%Easy0.006479067005887776https://leetcode.com/problems/remove-linked-list-elements
181390Four Divisors38.1%Medium0https://leetcode.com/problems/four-divisors