LeetCode-Questions-CompanyWise/two-sigma_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

2.1 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2547Friend Circles58.6%Medium3.4457325845151185https://leetcode.com/problems/friend-circles
31048Longest String Chain54.7%Medium2.6183158453084423https://leetcode.com/problems/longest-string-chain
4918Maximum Sum Circular Subarray33.7%Medium1.7908991061017663https://leetcode.com/problems/maximum-sum-circular-subarray
5146LRU Cache33.2%Medium1.0128053210090022https://leetcode.com/problems/lru-cache
6123Best Time to Buy and Sell Stock III37.5%Hard0.8103008499673461https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii
744Wildcard Matching24.7%Hard0.8088199846507318https://leetcode.com/problems/wildcard-matching
8342Power of Four41.6%Easy0.5106053351870626https://leetcode.com/problems/power-of-four
9528Random Pick with Weight43.9%Medium0.37294088733187064https://leetcode.com/problems/random-pick-with-weight
10380Insert Delete GetRandom O(1)47.5%Medium0.348524374235988https://leetcode.com/problems/insert-delete-getrandom-o1
11710Random Pick with Blacklist32.5%Hard0.3161972427598021https://leetcode.com/problems/random-pick-with-blacklist
12289Game of Life54.5%Medium0.2465460268751668https://leetcode.com/problems/game-of-life
131163Last Substring in Lexicographical Order33.9%Hard0.11205740891571739https://leetcode.com/problems/last-substring-in-lexicographical-order
144Median of Two Sorted Arrays29.6%Hard0.09321199094445486https://leetcode.com/problems/median-of-two-sorted-arrays
1553Maximum Subarray46.5%Easy0.04299340685592046https://leetcode.com/problems/maximum-subarray
1656Merge Intervals39.3%Medium0.02150990613527447https://leetcode.com/problems/merge-intervals
17384Shuffle an Array52.8%Medium0.015250009609723824https://leetcode.com/problems/shuffle-an-array
18221Maximal Square37.7%Medium0.00988638798855515https://leetcode.com/problems/maximal-square
19349Intersection of Two Arrays62.5%Easy0.00725034896230682https://leetcode.com/problems/intersection-of-two-arrays
201186Maximum Subarray Sum with One Deletion37.5%Medium0https://leetcode.com/problems/maximum-subarray-sum-with-one-deletion