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

2.9 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
21Two Sum45.6%Easy0.6244209657434179https://leetcode.com/problems/two-sum
3169Majority Element58.7%Easy0.5183921604769917https://leetcode.com/problems/majority-element
45Longest Palindromic Substring29.5%Medium0.5065034436015775https://leetcode.com/problems/longest-palindromic-substring
5206Reverse Linked List62.5%Easy0.4004746383351513https://leetcode.com/problems/reverse-linked-list
68String to Integer (atoi)15.4%Medium0.34989797105896764https://leetcode.com/problems/string-to-integer-atoi
74Median of Two Sorted Arrays29.6%Hard0.2749994072467641https://leetcode.com/problems/median-of-two-sorted-arrays
821Merge Two Sorted Lists53.5%Easy0.24152080844569923https://leetcode.com/problems/merge-two-sorted-lists
9215Kth Largest Element in an Array55.4%Medium0.22333903562721621https://leetcode.com/problems/kth-largest-element-in-an-array
10160Intersection of Two Linked Lists40.6%Easy0.13857026686146906https://leetcode.com/problems/intersection-of-two-linked-lists
1120Valid Parentheses39.0%Easy0.10693122823835342https://leetcode.com/problems/valid-parentheses
12136Single Number65.5%Easy0.08335861851743445https://leetcode.com/problems/single-number
1333Search in Rotated Sorted Array34.5%Medium0.07777550022464022https://leetcode.com/problems/search-in-rotated-sorted-array
14240Search a 2D Matrix II43.2%Medium0.04647676584572884https://leetcode.com/problems/search-a-2d-matrix-ii
15143Reorder List37.1%Medium0.04554002588608351https://leetcode.com/problems/reorder-list
16121Best Time to Buy and Sell Stock50.5%Easy0.04215422741819192https://leetcode.com/problems/best-time-to-buy-and-sell-stock
17256Paint House52.1%Easy0.03937516523483013https://leetcode.com/problems/paint-house
18153Sum26.8%Medium0.0346167609048592https://leetcode.com/problems/3sum
19287Find the Duplicate Number55.5%Medium0.033896954598043594https://leetcode.com/problems/find-the-duplicate-number
20543Diameter of Binary Tree48.4%Easy0.032708305572393875https://leetcode.com/problems/diameter-of-binary-tree
211143Longest Common Subsequence58.4%Medium0.019772173115579716https://leetcode.com/problems/longest-common-subsequence
22394Decode String50.0%Medium0.0182820448374491https://leetcode.com/problems/decode-string
2376Minimum Window Substring34.6%Hard0.013966707481708198https://leetcode.com/problems/minimum-window-substring
24227Basic Calculator II36.9%Medium0.01239941490503826https://leetcode.com/problems/basic-calculator-ii
2556Merge Intervals39.3%Medium0.0034728286335985107https://leetcode.com/problems/merge-intervals
26190Reverse Bits39.8%Easy0.0018316700789167337https://leetcode.com/problems/reverse-bits
27546Remove Boxes42.7%Hard0https://leetcode.com/problems/remove-boxes
28625Minimum Factorization32.8%Medium0https://leetcode.com/problems/minimum-factorization