Files
LeetCode-Questions-CompanyWise/tripadvisor_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.7 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2149Max Points on a Line16.9%Hard0.08243941611799847https://leetcode.com/problems/max-points-on-a-line
3274H-Index36.1%Medium0.0632254597089662https://leetcode.com/problems/h-index
41213Intersection of Three Sorted Arrays78.9%Easy0.04401150329993394https://leetcode.com/problems/intersection-of-three-sorted-arrays
5692Top K Frequent Words51.8%Medium0.0439052078041538https://leetcode.com/problems/top-k-frequent-words
61002Find Common Characters67.7%Easy0.033176651317732786https://leetcode.com/problems/find-common-characters
765Valid Number15.3%Hard0.02168106606132404https://leetcode.com/problems/valid-number
8384Shuffle an Array52.8%Medium0.014706147389695468https://leetcode.com/problems/shuffle-an-array
9528Random Pick with Weight43.9%Medium0.014383563329954094https://leetcode.com/problems/random-pick-with-weight
10146LRU Cache33.2%Medium0.009807205116964715https://leetcode.com/problems/lru-cache
1133Search in Rotated Sorted Array34.5%Medium0.006961661779487692https://leetcode.com/problems/search-in-rotated-sorted-array
1273Set Matrix Zeroes43.1%Medium0.006699070439072842https://leetcode.com/problems/set-matrix-zeroes
1398Validate Binary Search Tree27.8%Medium0.0063060747091605324https://leetcode.com/problems/validate-binary-search-tree
14139Word Break40.1%Medium0.003755167762323698https://leetcode.com/problems/word-break
15101Symmetric Tree46.8%Easy0.0032666423495169026https://leetcode.com/problems/symmetric-tree
16206Reverse Linked List62.5%Easy0.002231770161393673https://leetcode.com/problems/reverse-linked-list
1770Climbing Stairs47.8%Easy0.0014753073158671238https://leetcode.com/problems/climbing-stairs