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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2525Contiguous Array42.8%Medium0.42990617361238165https://leetcode.com/problems/contiguous-array
3498Diagonal Traverse48.2%Medium0.32668133250056075https://leetcode.com/problems/diagonal-traverse
4855Exam Room43.1%Medium0.22345649138873985https://leetcode.com/problems/exam-room
51053Previous Permutation With One Swap48.5%Medium0.20067069546215116https://leetcode.com/problems/previous-permutation-with-one-swap
6437Path Sum III47.2%Medium0.13327677772817573https://leetcode.com/problems/path-sum-iii
71027Longest Arithmetic Sequence53.4%Medium0.11122563511022437https://leetcode.com/problems/longest-arithmetic-sequence
8780Reaching Points29.4%Hard0.1040197878075301https://leetcode.com/problems/reaching-points
9390Elimination Game44.5%Medium0.0922312242160336https://leetcode.com/problems/elimination-game
101329Sort the Matrix Diagonally78.4%Medium0.08584868273025201https://leetcode.com/problems/sort-the-matrix-diagonally
11452Minimum Number of Arrows to Burst Balloons49.6%Medium0.06234705801852781https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
12297Serialize and Deserialize Binary Tree47.5%Hard0.05889827677358506https://leetcode.com/problems/serialize-and-deserialize-binary-tree
13113Path Sum II46.7%Medium0.03698133452871584https://leetcode.com/problems/path-sum-ii
14253Meeting Rooms II45.7%Medium0.017208837680639542https://leetcode.com/problems/meeting-rooms-ii
1548Rotate Image56.7%Medium0.010933053508947611https://leetcode.com/problems/rotate-image
16380Insert Delete GetRandom O(1)47.5%Medium0.00934149716911291https://leetcode.com/problems/insert-delete-getrandom-o1
17162Find Peak Element43.3%Medium0.006070742577979871https://leetcode.com/problems/find-peak-element
18560Subarray Sum Equals K43.9%Medium0.00407664649376343https://leetcode.com/problems/subarray-sum-equals-k