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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2274H-Index36.1%Medium0.18810197835269699https://leetcode.com/problems/h-index
3146LRU Cache33.2%Medium0.14642426807449366https://leetcode.com/problems/lru-cache
4149Max Points on a Line16.9%Hard0.13811211729480913https://leetcode.com/problems/max-points-on-a-line
51213Intersection of Three Sorted Arrays78.9%Easy0.09643440701660581https://leetcode.com/problems/intersection-of-three-sorted-arrays
673Set Matrix Zeroes43.1%Medium0.07912453490203865https://leetcode.com/problems/set-matrix-zeroes
7692Top K Frequent Words51.8%Medium0.06262915907044142https://leetcode.com/problems/top-k-frequent-words
8528Random Pick with Weight43.9%Medium0.056333090457586533https://leetcode.com/problems/random-pick-with-weight
965Valid Number15.3%Hard0.04813763559815448https://leetcode.com/problems/valid-number
10206Reverse Linked List62.5%Easy0.03512406277610997https://leetcode.com/problems/reverse-linked-list
1198Validate Binary Search Tree27.8%Medium0.033861720512945864https://leetcode.com/problems/validate-binary-search-tree
121002Find Common Characters67.7%Easy0.033176651317732786https://leetcode.com/problems/find-common-characters
1333Search in Rotated Sorted Array34.5%Medium0.019219533793635182https://leetcode.com/problems/search-in-rotated-sorted-array
14384Shuffle an Array52.8%Medium0.014706147389695468https://leetcode.com/problems/shuffle-an-array
15101Symmetric Tree46.8%Easy0.013003027580387157https://leetcode.com/problems/symmetric-tree
1670Climbing Stairs47.8%Easy0.005888214855949732https://leetcode.com/problems/climbing-stairs
17139Word Break40.1%Medium0.003755167762323698https://leetcode.com/problems/word-break