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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2221Maximal Square37.7%Medium0.15207505771969548https://leetcode.com/problems/maximal-square
31Two Sum45.6%Easy0.1158551535649608https://leetcode.com/problems/two-sum
445Jump Game II30.6%Hard0.07963524941022611https://leetcode.com/problems/jump-game-ii
543Multiply Strings33.9%Medium0.0760823064574395https://leetcode.com/problems/multiply-strings
63Longest Substring Without Repeating Characters30.4%Medium0.06090436166020607https://leetcode.com/problems/longest-substring-without-repeating-characters
7394Decode String50.0%Medium0.0476916619317836https://leetcode.com/problems/decode-string
8617Merge Two Binary Trees74.1%Easy0.017748444595195822https://leetcode.com/problems/merge-two-binary-trees
9387First Unique Character in a String53.4%Easy0.01587334915629015https://leetcode.com/problems/first-unique-character-in-a-string
104Median of Two Sorted Arrays29.6%Hard0.014786333530311531https://leetcode.com/problems/median-of-two-sorted-arrays
115Longest Palindromic Substring29.5%Medium0.013529809159515602https://leetcode.com/problems/longest-palindromic-substring
1291Decode Ways24.7%Medium0.012884931303860403https://leetcode.com/problems/decode-ways
1369Sqrt(x)33.9%Easy0.010949014489670414https://leetcode.com/problems/sqrtx
142Add Two Numbers33.9%Medium0.010079917618007224https://leetcode.com/problems/add-two-numbers
1542Trapping Rain Water48.9%Hard0.009245058144051103https://leetcode.com/problems/trapping-rain-water
1670Climbing Stairs47.8%Easy0.009185162673517763https://leetcode.com/problems/climbing-stairs
17151Reverse Words in a String21.9%Medium0.0034304043397445187https://leetcode.com/problems/reverse-words-in-a-string
1821Merge Two Sorted Lists53.5%Easy0.002158080146984904https://leetcode.com/problems/merge-two-sorted-lists