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

2.9 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
21473Paint House III48.1%Hard0.4279239789584774https://leetcode.com/problems/paint-house-iii
31041Robot Bounded In Circle49.6%Medium0.26986631760028884https://leetcode.com/problems/robot-bounded-in-circle
41497Check If Array Pairs Are Divisible by k41.1%Medium0.2357666456855048https://leetcode.com/problems/check-if-array-pairs-are-divisible-by-k
51297Maximum Number of Occurrences of a Substring47.3%Medium0.07770898432731625https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
656Merge Intervals39.3%Medium0.04173304225331761https://leetcode.com/problems/merge-intervals
7243Shortest Word Distance61.0%Easy0.040780370344928096https://leetcode.com/problems/shortest-word-distance
8324Wiggle Sort II29.9%Medium0.02898753687325229https://leetcode.com/problems/wiggle-sort-ii
968Text Justification27.7%Hard0.0276451606661453https://leetcode.com/problems/text-justification
1012Integer to Roman55.1%Medium0.019096697456456382https://leetcode.com/problems/integer-to-roman
11146LRU Cache33.2%Medium0.01827577993873683https://leetcode.com/problems/lru-cache
1273Set Matrix Zeroes43.1%Medium0.015715357479628243https://leetcode.com/problems/set-matrix-zeroes
13977Squares of a Sorted Array72.1%Easy0.015474196582597383https://leetcode.com/problems/squares-of-a-sorted-array
1420Valid Parentheses39.0%Easy0.014292491180025941https://leetcode.com/problems/valid-parentheses
151047Remove All Adjacent Duplicates In String68.6%Easy0.013059277989179281https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string
16227Basic Calculator II36.9%Medium0.01239941490503826https://leetcode.com/problems/basic-calculator-ii
17242Valid Anagram56.9%Easy0.009322628116274939https://leetcode.com/problems/valid-anagram
18128Longest Consecutive Sequence45.1%Hard0.009051883485315484https://leetcode.com/problems/longest-consecutive-sequence
19876Middle of the Linked List68.4%Easy0.007624893975696915https://leetcode.com/problems/middle-of-the-linked-list
202Add Two Numbers33.9%Medium0.006737434951993369https://leetcode.com/problems/add-two-numbers
21973K Closest Points to Origin63.8%Medium0.005773688094426333https://leetcode.com/problems/k-closest-points-to-origin
2275Sort Colors47.3%Medium0.004992521603120986https://leetcode.com/problems/sort-colors
2353Maximum Subarray46.5%Easy0.004869349014182134https://leetcode.com/problems/maximum-subarray
24189Rotate Array34.7%Easy0.004029826126500844https://leetcode.com/problems/rotate-array
251Two Sum45.6%Easy0.003278422738041615https://leetcode.com/problems/two-sum
265Longest Palindromic Substring29.5%Medium0.002279333142507479https://leetcode.com/problems/longest-palindromic-substring
27153Sum26.8%Medium0.0021990113314367685https://leetcode.com/problems/3sum