LeetCode-Questions-CompanyWise/lyft_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.9 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2735Asteroid Collision41.0%Medium1.473090540195022https://leetcode.com/problems/asteroid-collision
3238Product of Array Except Self60.1%Medium1.0067649782470638https://leetcode.com/problems/product-of-array-except-self
4365Water and Jug Problem30.6%Medium0.8801037398580485https://leetcode.com/problems/water-and-jug-problem
5981Time Based Key-Value Store53.1%Medium0.8180951326968029https://leetcode.com/problems/time-based-key-value-store
6158Read N Characters Given Read4 II - Call multiple times33.8%Hard0.752091950433346https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times
7716Max Stack42.6%Easy0.6330336058902137https://leetcode.com/problems/max-stack
8127Word Ladder29.6%Medium0.1667080439422554https://leetcode.com/problems/word-ladder
9642Design Search Autocomplete System44.7%Hard0.16312782492496253https://leetcode.com/problems/design-search-autocomplete-system
10426Convert Binary Search Tree to Sorted Doubly Linked List59.1%Medium0.09352605801082346https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list
11109Convert Sorted List to Binary Search Tree47.7%Medium0.08701137698962977https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
1276Minimum Window Substring34.6%Hard0.05473322196089386https://leetcode.com/problems/minimum-window-substring
13304Range Sum Query 2D - Immutable38.6%Medium0.054527987071175225https://leetcode.com/problems/range-sum-query-2d-immutable
1491Decode Ways24.7%Medium0.03673102791879485https://leetcode.com/problems/decode-ways
151060Missing Element in Sorted Array54.5%Medium0.017429635135283658https://leetcode.com/problems/missing-element-in-sorted-array
1623Merge k Sorted Lists40.2%Hard0.016108271385328228https://leetcode.com/problems/merge-k-sorted-lists
1710Regular Expression Matching26.8%Hard0.01609764684284749https://leetcode.com/problems/regular-expression-matching
18567Permutation in String44.4%Medium0.014947961435873182https://leetcode.com/problems/permutation-in-string
1988Merge Sorted Array39.4%Easy0.011986958032982505https://leetcode.com/problems/merge-sorted-array
2048Rotate Image56.7%Medium0.011428695823622754https://leetcode.com/problems/rotate-image
2120Valid Parentheses39.0%Easy0.009170695326061695https://leetcode.com/problems/valid-parentheses
22253Meeting Rooms II45.7%Medium0.008079219870546493https://leetcode.com/problems/meeting-rooms-ii
23349Intersection of Two Arrays62.5%Easy0.00725034896230682https://leetcode.com/problems/intersection-of-two-arrays
24146LRU Cache33.2%Medium0.004600353139061353https://leetcode.com/problems/lru-cache
2517Letter Combinations of a Phone Number46.8%Medium0.0044018999217624675https://leetcode.com/problems/letter-combinations-of-a-phone-number