Files
LeetCode-Questions-CompanyWise/roblox_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.2 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2811Subdomain Visit Count69.9%Easy1.219366809852767https://leetcode.com/problems/subdomain-visit-count
3829Consecutive Numbers Sum37.5%Hard0.9369106040185756https://leetcode.com/problems/consecutive-numbers-sum
4770Basic Calculator IV48.1%Hard0.6957297563903937https://leetcode.com/problems/basic-calculator-iv
51163Last Substring in Lexicographical Order33.9%Hard0.4636668007546091https://leetcode.com/problems/last-substring-in-lexicographical-order
6224Basic Calculator36.8%Hard0.44951029049735747https://leetcode.com/problems/basic-calculator
71297Maximum Number of Occurrences of a Substring47.3%Medium0.1670540846631662https://leetcode.com/problems/maximum-number-of-occurrences-of-a-substring
81328Break a Palindrome43.3%Medium0.12838116664820678https://leetcode.com/problems/break-a-palindrome
91248Count Number of Nice Subarrays56.4%Medium0.1005310110120055https://leetcode.com/problems/count-number-of-nice-subarrays
10146LRU Cache33.2%Medium0.054946555458745445https://leetcode.com/problems/lru-cache
11239Sliding Window Maximum43.0%Hard0.0483746857022364https://leetcode.com/problems/sliding-window-maximum
121290Convert Binary Number in a Linked List to Integer80.4%Easy0.04161848998251485https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer
1337Sudoku Solver43.6%Hard0.01821543989134118https://leetcode.com/problems/sudoku-solver
1417Letter Combinations of a Phone Number46.8%Medium0.017492519932499718https://leetcode.com/problems/letter-combinations-of-a-phone-number
1536Valid Sudoku48.7%Medium0.01625758350956095https://leetcode.com/problems/valid-sudoku
16647Palindromic Substrings60.6%Medium0.010400509768078022https://leetcode.com/problems/palindromic-substrings
17212Word Search II34.9%Hard0.009845021678804893https://leetcode.com/problems/word-search-ii
185Longest Palindromic Substring29.5%Medium0.009086325220960808https://leetcode.com/problems/longest-palindromic-substring
19200Number of Islands46.8%Medium0.0028897578265903614https://leetcode.com/problems/number-of-islands
201Two Sum45.6%Easy0.0008206138651873125https://leetcode.com/problems/two-sum