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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2312Burst Balloons51.8%Hard0.1436030350715959https://leetcode.com/problems/burst-balloons
31Two Sum45.6%Easy0.10724153306109706https://leetcode.com/problems/two-sum
4572Subtree of Another Tree44.1%Easy0.08694829147719678https://leetcode.com/problems/subtree-of-another-tree
531Next Permutation32.6%Medium0.05058678946669793https://leetcode.com/problems/next-permutation
685Maximal Rectangle37.7%Hard0.050135812424355455https://leetcode.com/problems/maximal-rectangle
720Valid Parentheses39.0%Easy0.04358808999497224https://leetcode.com/problems/valid-parentheses
832Longest Valid Parentheses28.4%Hard0.03477099521294092https://leetcode.com/problems/longest-valid-parentheses
9153Sum26.8%Medium0.03278982282299087https://leetcode.com/problems/3sum
10184Sum33.7%Medium0.02090668481931367https://leetcode.com/problems/4sum
1133Search in Rotated Sorted Array34.5%Medium0.019219533793635182https://leetcode.com/problems/search-in-rotated-sorted-array
1222Generate Parentheses62.7%Medium0.016507132273019587https://leetcode.com/problems/generate-parentheses
13876Middle of the Linked List68.4%Easy0.01631061893137506https://leetcode.com/problems/middle-of-the-linked-list
145Longest Palindromic Substring29.5%Medium0.013529809159515602https://leetcode.com/problems/longest-palindromic-substring
153Longest Substring Without Repeating Characters30.4%Medium0.013288251045064422https://leetcode.com/problems/longest-substring-without-repeating-characters
16523Continuous Subarray Sum24.6%Medium0.011293174793455513https://leetcode.com/problems/continuous-subarray-sum
17103Binary Tree Zigzag Level Order Traversal48.3%Medium0.010504298266876018https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
18190Reverse Bits39.8%Easy0.007245095991891571https://leetcode.com/problems/reverse-bits
19127Word Ladder29.6%Medium0.005731495844689608https://leetcode.com/problems/word-ladder
2021Merge Two Sorted Lists53.5%Easy0.004849147433009811https://leetcode.com/problems/merge-two-sorted-lists
21653Two Sum IV - Input is a BST55.5%Easy0https://leetcode.com/problems/two-sum-iv-input-is-a-bst
22987Vertical Order Traversal of a Binary Tree36.6%Medium0https://leetcode.com/problems/vertical-order-traversal-of-a-binary-tree
231301Number of Paths with Max Score37.3%Hard0https://leetcode.com/problems/number-of-paths-with-max-score
241139Largest 1-Bordered Square47.5%Medium0https://leetcode.com/problems/largest-1-bordered-square
251464Maximum Product of Two Elements in an Array78.1%Easy0https://leetcode.com/problems/maximum-product-of-two-elements-in-an-array
261519Number of Nodes in the Sub-Tree With the Same Label35.2%Medium0https://leetcode.com/problems/number-of-nodes-in-the-sub-tree-with-the-same-label