Files
LeetCode-Questions-CompanyWise/airbnb_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

2.3 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2755Pour Water43.3%Medium1.6549959634129805https://leetcode.com/problems/pour-water
31166Design File System56.8%Medium1.578042968988746https://leetcode.com/problems/design-file-system
4336Palindrome Pairs33.7%Hard1.3086247857193076https://leetcode.com/problems/palindrome-pairs
5166Fraction to Recurring Decimal21.6%Medium1.110416810228655https://leetcode.com/problems/fraction-to-recurring-decimal
6875Koko Eating Bananas52.1%Medium0.8409986269592165https://leetcode.com/problems/koko-eating-bananas
7773Sliding Puzzle59.3%Hard0.6810258200276005https://leetcode.com/problems/sliding-puzzle
8864Shortest Path to Get All Keys40.1%Hard0.6061358035703156https://leetcode.com/problems/shortest-path-to-get-all-keys
9787Cheapest Flights Within K Stops39.3%Medium0.5212226928497461https://leetcode.com/problems/cheapest-flights-within-k-stops
10269Alien Dictionary33.3%Hard0.48723106280473205https://leetcode.com/problems/alien-dictionary
11251Flatten 2D Vector45.7%Medium0.4808790962829651https://leetcode.com/problems/flatten-2d-vector
121257Smallest Common Region58.8%Medium0.2561688067457042https://leetcode.com/problems/smallest-common-region
1368Text Justification27.7%Hard0.16143214434637243https://leetcode.com/problems/text-justification
141235Maximum Profit in Job Scheduling44.0%Hard0.1532629744871177https://leetcode.com/problems/maximum-profit-in-job-scheduling
1539Combination Sum56.1%Medium0.1339254107186325https://leetcode.com/problems/combination-sum
16324Wiggle Sort II29.9%Medium0.11122563511022437https://leetcode.com/problems/wiggle-sort-ii
17759Employee Free Time66.2%Hard0.10623186692973738https://leetcode.com/problems/employee-free-time
18280Wiggle Sort63.8%Medium0.04362742017962607https://leetcode.com/problems/wiggle-sort
19322Coin Change35.5%Medium0.024924029676386045https://leetcode.com/problems/coin-change
20341Flatten Nested List Iterator52.9%Medium0.019980684690483426https://leetcode.com/problems/flatten-nested-list-iterator
21236Lowest Common Ancestor of a Binary Tree45.7%Medium0.004714210262726446https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree
2242Trapping Rain Water48.9%Hard0.004350670338744988https://leetcode.com/problems/trapping-rain-water