LeetCode-Questions-CompanyWise/qualtrics_1year.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
2695Max Area of Island62.7%Medium0.09988789637571764https://leetcode.com/problems/max-area-of-island
3127Word Ladder29.6%Medium0.06918942849168566https://leetcode.com/problems/word-ladder
442Trapping Rain Water48.9%Hard0.038490960607653675https://leetcode.com/problems/trapping-rain-water
5729My Calendar I51.8%Medium0.036433902246102004https://leetcode.com/problems/my-calendar-i
6139Word Break40.1%Medium0.03451593709018879https://leetcode.com/problems/word-break
7332Reconstruct Itinerary36.7%Medium0.030687713231237448https://leetcode.com/problems/reconstruct-itinerary
8138Copy List with Random Pointer36.4%Medium0.02453734514188008https://leetcode.com/problems/copy-list-with-random-pointer
9103Binary Tree Zigzag Level Order Traversal48.3%Medium0.020730076462920684https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal
10173Binary Search Tree Iterator56.6%Medium0.01899993824490396https://leetcode.com/problems/binary-search-tree-iterator
11131Palindrome Partitioning47.5%Medium0.013903595538577326https://leetcode.com/problems/palindrome-partitioning
12767Reorganize String48.7%Medium0.01329806830463147https://leetcode.com/problems/reorganize-string
13733Flood Fill55.3%Easy0.011217167530924988https://leetcode.com/problems/flood-fill
14208Implement Trie (Prefix Tree)49.4%Medium0.009105457856626612https://leetcode.com/problems/implement-trie-prefix-tree
15238Product of Array Except Self60.1%Medium0.008821856860216758https://leetcode.com/problems/product-of-array-except-self
1613Roman to Integer55.7%Easy0.007698267425752388https://leetcode.com/problems/roman-to-integer
17200Number of Islands46.8%Medium0.006490251382779317https://leetcode.com/problems/number-of-islands
18153Sum26.8%Medium0.004940992758742591https://leetcode.com/problems/3sum