Files
LeetCode-Questions-CompanyWise/zenefits_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.2 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
242Trapping Rain Water48.9%Hard0.2080272315165578https://leetcode.com/problems/trapping-rain-water
352N-Queens II57.9%Hard0.20340920294292344https://leetcode.com/problems/n-queens-ii
4255Verify Preorder Sequence in Binary Search Tree45.7%Medium0.1348842676899421https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree
5251Flatten 2D Vector45.7%Medium0.06635933243696077https://leetcode.com/problems/flatten-2d-vector
6317Shortest Distance from All Buildings41.4%Hard0.03795522000043556https://leetcode.com/problems/shortest-distance-from-all-buildings
7109Convert Sorted List to Binary Search Tree47.7%Medium0.03220314049463475https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
8206Reverse Linked List62.5%Easy0.02086427467076072https://leetcode.com/problems/reverse-linked-list
9146LRU Cache33.2%Medium0.01827577993873683https://leetcode.com/problems/lru-cache
1020Valid Parentheses39.0%Easy0.009170695326061695https://leetcode.com/problems/valid-parentheses
114Median of Two Sorted Arrays29.6%Hard0.008754068159914991https://leetcode.com/problems/median-of-two-sorted-arrays
12210Course Schedule II40.7%Medium0.007612921575561963https://leetcode.com/problems/course-schedule-ii
13200Number of Islands46.8%Medium0.006490251382779317https://leetcode.com/problems/number-of-islands
1422Generate Parentheses62.7%Medium0https://leetcode.com/problems/generate-parentheses
15125Valid Palindrome36.7%Easy0https://leetcode.com/problems/valid-palindrome
16155Min Stack44.5%Easy0https://leetcode.com/problems/min-stack
17168Excel Sheet Column Title31.1%Easy0https://leetcode.com/problems/excel-sheet-column-title
18169Majority Element58.7%Easy0https://leetcode.com/problems/majority-element
19207Course Schedule43.1%Medium0https://leetcode.com/problems/course-schedule
20229Majority Element II35.6%Medium0https://leetcode.com/problems/majority-element-ii
21239Sliding Window Maximum43.0%Hard0https://leetcode.com/problems/sliding-window-maximum
22261Graph Valid Tree42.2%Medium0https://leetcode.com/problems/graph-valid-tree