Files
LeetCode-Questions-CompanyWise/samsung_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.1 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2312Burst Balloons51.8%Hard0.05677042474639432https://leetcode.com/problems/burst-balloons
332Longest Valid Parentheses28.4%Hard0.03477099521294092https://leetcode.com/problems/longest-valid-parentheses
485Maximal Rectangle37.7%Hard0.012771565679487524https://leetcode.com/problems/maximal-rectangle
5523Continuous Subarray Sum24.6%Medium0.011293174793455513https://leetcode.com/problems/continuous-subarray-sum
6572Subtree of Another Tree44.1%Easy0.010042765802138606https://leetcode.com/problems/subtree-of-another-tree
7184Sum33.7%Medium0.009345862418237686https://leetcode.com/problems/4sum
8876Middle of the Linked List68.4%Easy0.007282027445765432https://leetcode.com/problems/middle-of-the-linked-list
9190Reverse Bits39.8%Easy0.007245095991891571https://leetcode.com/problems/reverse-bits
1031Next Permutation32.6%Medium0.005748794217024406https://leetcode.com/problems/next-permutation
11127Word Ladder29.6%Medium0.005731495844689608https://leetcode.com/problems/word-ladder
125Longest Palindromic Substring29.5%Medium0.0048918458243339055https://leetcode.com/problems/longest-palindromic-substring
1322Generate Parentheses62.7%Medium0.004152398782798953https://leetcode.com/problems/generate-parentheses
141Two Sum45.6%Easy0.003139596786381058https://leetcode.com/problems/two-sum
1533Search in Rotated Sorted Array34.5%Medium0.0031000567336666443https://leetcode.com/problems/search-in-rotated-sorted-array
1620Valid Parentheses39.0%Easy0.002197682330605871https://leetcode.com/problems/valid-parentheses
1721Merge Two Sorted Lists53.5%Easy0.002158080146984904https://leetcode.com/problems/merge-two-sorted-lists
18153Sum26.8%Medium0.002081166203824567https://leetcode.com/problems/3sum
19103Binary Tree Zigzag Level Order Traversal48.3%Medium0.0016881202574030904https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
203Longest Substring Without Repeating Characters30.4%Medium0.0014852223137141987https://leetcode.com/problems/longest-substring-without-repeating-characters