Files
LeetCode-Questions-CompanyWise/quora_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

2.7 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
29233Sum With Multiplicity35.7%Medium2.764795138719407https://leetcode.com/problems/3sum-with-multiplicity
3855Exam Room43.1%Medium1.610689085571983https://leetcode.com/problems/exam-room
4525Contiguous Array42.8%Medium0.4565830324245594https://leetcode.com/problems/contiguous-array
5297Serialize and Deserialize Binary Tree47.5%Hard0.3967767600825713https://leetcode.com/problems/serialize-and-deserialize-binary-tree
6498Diagonal Traverse48.2%Medium0.3533581913127385https://leetcode.com/problems/diagonal-traverse
7437Path Sum III47.2%Medium0.3499312788602187https://leetcode.com/problems/path-sum-iii
81053Previous Permutation With One Swap48.5%Medium0.20067069546215116https://leetcode.com/problems/previous-permutation-with-one-swap
91027Longest Arithmetic Sequence53.4%Medium0.11122563511022437https://leetcode.com/problems/longest-arithmetic-sequence
10780Reaching Points29.4%Hard0.1040197878075301https://leetcode.com/problems/reaching-points
11390Elimination Game44.5%Medium0.0922312242160336https://leetcode.com/problems/elimination-game
121329Sort the Matrix Diagonally78.4%Medium0.08584868273025201https://leetcode.com/problems/sort-the-matrix-diagonally
13113Path Sum II46.7%Medium0.08136403462264583https://leetcode.com/problems/path-sum-ii
14380Insert Delete GetRandom O(1)47.5%Medium0.08108897817576358https://leetcode.com/problems/insert-delete-getrandom-o1
15852Peak Index in a Mountain Array71.6%Easy0.07347604683062181https://leetcode.com/problems/peak-index-in-a-mountain-array
16162Find Peak Element43.3%Medium0.07194178450299923https://leetcode.com/problems/find-peak-element
17253Meeting Rooms II45.7%Medium0.06712677912083971https://leetcode.com/problems/meeting-rooms-ii
18452Minimum Number of Arrows to Burst Balloons49.6%Medium0.06234705801852781https://leetcode.com/problems/minimum-number-of-arrows-to-burst-balloons
1914Longest Common Prefix35.4%Easy0.038247071811121705https://leetcode.com/problems/longest-common-prefix
20153Sum26.8%Medium0.025200613617298306https://leetcode.com/problems/3sum
2131Next Permutation32.6%Medium0.022799505676746757https://leetcode.com/problems/next-permutation
2239Combination Sum56.1%Medium0.012215135595650004https://leetcode.com/problems/combination-sum
2348Rotate Image56.7%Medium0.010933053508947611https://leetcode.com/problems/rotate-image
24560Subarray Sum Equals K43.9%Medium0.00407664649376343https://leetcode.com/problems/subarray-sum-equals-k
25198House Robber42.0%Easy0.003611415987216383https://leetcode.com/problems/house-robber
261Two Sum45.6%Easy0.000785823780173602https://leetcode.com/problems/two-sum