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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2829Consecutive Numbers Sum37.5%Hard1.1124320366213494https://leetcode.com/problems/consecutive-numbers-sum
3770Basic Calculator IV48.1%Hard0.8712511889931674https://leetcode.com/problems/basic-calculator-iv
4811Subdomain Visit Count69.9%Easy0.8612377057497951https://leetcode.com/problems/subdomain-visit-count
51163Last Substring in Lexicographical Order33.9%Hard0.6391882333573828https://leetcode.com/problems/last-substring-in-lexicographical-order
6224Basic Calculator36.8%Hard0.4082349322913481https://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
1436Valid Sudoku48.7%Medium0.01625758350956095https://leetcode.com/problems/valid-sudoku
15647Palindromic Substrings60.6%Medium0.010400509768078022https://leetcode.com/problems/palindromic-substrings
1617Letter Combinations of a Phone Number46.8%Medium0.00987716546167603https://leetcode.com/problems/letter-combinations-of-a-phone-number
17200Number of Islands46.8%Medium0.0028897578265903614https://leetcode.com/problems/number-of-islands
181Two Sum45.6%Easy0.0008206138651873125https://leetcode.com/problems/two-sum