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

1.9 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2128Longest Consecutive Sequence45.1%Hard0.12090519978650899https://leetcode.com/problems/longest-consecutive-sequence
3383Ransom Note53.1%Easy0.1053605156578263https://leetcode.com/problems/ransom-note
4286Walls and Gates54.5%Medium0.089897664246389https://leetcode.com/problems/walls-and-gates
5480Sliding Window Median37.2%Hard0.0743529801177063https://leetcode.com/problems/sliding-window-median
620Valid Parentheses39.0%Easy0.06735240264428982https://leetcode.com/problems/valid-parentheses
722Generate Parentheses62.7%Medium0.05215612134598845https://leetcode.com/problems/generate-parentheses
8146LRU Cache33.2%Medium0.040660598211268925https://leetcode.com/problems/lru-cache
9215Kth Largest Element in an Array55.4%Medium0.03458557964977998https://leetcode.com/problems/kth-largest-element-in-an-array
10443String Compression41.3%Easy0.031026273563100573https://leetcode.com/problems/string-compression
1166Plus One43.0%Easy0.028982869090985654https://leetcode.com/problems/plus-one
12200Number of Islands46.8%Medium0.025712029212602353https://leetcode.com/problems/number-of-islands
13784Letter Case Permutation64.6%Medium0.02026411791905559https://leetcode.com/problems/letter-case-permutation
14127Word Ladder29.6%Medium0.013403030127340374https://leetcode.com/problems/word-ladder
153Longest Substring Without Repeating Characters30.4%Medium0.009683242444739549https://leetcode.com/problems/longest-substring-without-repeating-characters
16206Reverse Linked List62.5%Easy0.009326794511974934https://leetcode.com/problems/reverse-linked-list
171Two Sum45.6%Easy0.0073613942765888805https://leetcode.com/problems/two-sum
18412Fizz Buzz62.3%Easy0.007165921026143679https://leetcode.com/problems/fizz-buzz
19347Top K Frequent Elements61.2%Medium0.0033396446491217604https://leetcode.com/problems/top-k-frequent-elements