Files
LeetCode-Questions-CompanyWise/yelp_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.4 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2599Minimum Index Sum of Two Lists50.7%Easy0.4762677241497535https://leetcode.com/problems/minimum-index-sum-of-two-lists
3355Design Twitter30.3%Medium0.4013575056633937https://leetcode.com/problems/design-twitter
41126Active Businesses68.5%Medium0.3208150073042144https://leetcode.com/problems/active-businesses
5692Top K Frequent Words51.8%Medium0.24027250894503516https://leetcode.com/problems/top-k-frequent-words
6564Find the Closest Palindrome19.7%Hard0.18012616623051897https://leetcode.com/problems/find-the-closest-palindrome
7347Top K Frequent Elements61.2%Medium0.1517903074513627https://leetcode.com/problems/top-k-frequent-elements
8528Random Pick with Weight43.9%Medium0.12617342152539626https://leetcode.com/problems/random-pick-with-weight
9192Word Frequency25.8%Medium0.10186917331721722https://leetcode.com/problems/word-frequency
10332Reconstruct Itinerary36.7%Medium0.08302143328026106https://leetcode.com/problems/reconstruct-itinerary
11253Meeting Rooms II45.7%Medium0.04945628059066218https://leetcode.com/problems/meeting-rooms-ii
1256Merge Intervals39.3%Medium0.030829638084076787https://leetcode.com/problems/merge-intervals
13273Integer to English Words27.1%Hard0.026980053764546055https://leetcode.com/problems/integer-to-english-words
14205Isomorphic Strings39.8%Easy0.011544139746865315https://leetcode.com/problems/isomorphic-strings
15380Insert Delete GetRandom O(1)47.5%Medium0.009820849864094454https://leetcode.com/problems/insert-delete-getrandom-o1
16139Word Break40.1%Medium0.008741314401573542https://leetcode.com/problems/word-break
17239Sliding Window Maximum43.0%Hard0.007898935224534491https://leetcode.com/problems/sliding-window-maximum
18349Intersection of Two Arrays62.5%Easy0.00725034896230682https://leetcode.com/problems/intersection-of-two-arrays
1939Combination Sum56.1%Medium0.005715934396440999https://leetcode.com/problems/combination-sum
2022Generate Parentheses62.7%Medium0.0043611059090124735https://leetcode.com/problems/generate-parentheses
2114Longest Common Prefix35.4%Easy0.003320331762984143https://leetcode.com/problems/longest-common-prefix
223Longest Substring Without Repeating Characters30.4%Medium0.0015556336509412823https://leetcode.com/problems/longest-substring-without-repeating-characters