LeetCode-Questions-CompanyWise/akuna-capital_2year.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
Raw Permalink Blame History

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2713Subarray Product Less Than K39.1%Medium0.6727517560064701https://leetcode.com/problems/subarray-product-less-than-k
31223Dice Roll Simulation45.6%Medium0.5140462384660329https://leetcode.com/problems/dice-roll-simulation
41411Number of Ways to Paint N × 3 Grid61.1%Hard0.35534072092559577https://leetcode.com/problems/number-of-ways-to-paint-n-3-grid
51177Can Make Palindrome from Substring34.6%Medium0.24991141156531438https://leetcode.com/problems/can-make-palindrome-from-substring
6995Minimum Number of K Consecutive Bit Flips46.8%Hard0.19004360288786493https://leetcode.com/problems/minimum-number-of-k-consecutive-bit-flips
7324Wiggle Sort II29.9%Medium0.168749479248411https://leetcode.com/problems/wiggle-sort-ii
81319Number of Operations to Make Network Connected53.1%Medium0.04587960575069364https://leetcode.com/problems/number-of-operations-to-make-network-connected
948Rotate Image56.7%Medium0.020228249775471566https://leetcode.com/problems/rotate-image
101048Longest String Chain54.7%Medium0.019361689049145963https://leetcode.com/problems/longest-string-chain
11443String Compression41.3%Easy0.01390843004613198https://leetcode.com/problems/string-compression
1239Combination Sum56.1%Medium0.005715934396440999https://leetcode.com/problems/combination-sum
13152Maximum Product Subarray31.7%Medium0.005590510716885066https://leetcode.com/problems/maximum-product-subarray
14153Sum26.8%Medium0.004940992758742591https://leetcode.com/problems/3sum
1520Valid Parentheses39.0%Easy0.0023005704055949323https://leetcode.com/problems/valid-parentheses
16121Best Time to Buy and Sell Stock50.5%Easy0.0021239321954525975https://leetcode.com/problems/best-time-to-buy-and-sell-stock