LeetCode-Questions-CompanyWise/palantir-technologies_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
2393UTF-8 Validation37.5%Medium5.339542531545812https://leetcode.com/problems/utf-8-validation
3539Minimum Time Difference51.5%Medium4.5282542854816565https://leetcode.com/problems/minimum-time-difference
456Merge Intervals39.3%Medium2.7963305586450815https://leetcode.com/problems/merge-intervals
5273Integer to English Words27.1%Hard1.064406831808506https://leetcode.com/problems/integer-to-english-words
6146LRU Cache33.2%Medium1.0128053210090022https://leetcode.com/problems/lru-cache
7200Number of Islands46.8%Medium0.475271166771https://leetcode.com/problems/number-of-islands
8277Find the Celebrity41.8%Medium0.3142660340639637https://leetcode.com/problems/find-the-celebrity
9733Flood Fill55.3%Easy0.20573399741869788https://leetcode.com/problems/flood-fill
10220Contains Duplicate III20.9%Medium0.20432784239539936https://leetcode.com/problems/contains-duplicate-iii
11285Inorder Successor in BST40.4%Medium0.13204807962078746https://leetcode.com/problems/inorder-successor-in-bst
1242Trapping Rain Water48.9%Hard0.12389276378675394https://leetcode.com/problems/trapping-rain-water
1310Regular Expression Matching26.8%Hard0.02844130559772196https://leetcode.com/problems/regular-expression-matching
1453Maximum Subarray46.5%Easy0.013467854269413949https://leetcode.com/problems/maximum-subarray
15219Contains Duplicate II37.7%Easy0.01276748910345265https://leetcode.com/problems/contains-duplicate-ii
16695Max Area of Island62.7%Medium0.012686500631003836https://leetcode.com/problems/max-area-of-island
1748Rotate Image56.7%Medium0.011428695823622754https://leetcode.com/problems/rotate-image
18217Contains Duplicate56.0%Easy0.008525200823359648https://leetcode.com/problems/contains-duplicate
19136Single Number65.5%Easy0.006445166968713385https://leetcode.com/problems/single-number
20303Range Sum Query - Immutable44.7%Easy0https://leetcode.com/problems/range-sum-query-immutable
21325Maximum Size Subarray Sum Equals k46.8%Medium0https://leetcode.com/problems/maximum-size-subarray-sum-equals-k