mirror of
https://github.com/krishnadey30/LeetCode-Questions-CompanyWise.git
synced 2025-12-28 05:34:42 +00:00
## 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)
```
2.3 KiB
2.3 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 388 | Longest Absolute File Path | 41.8% | Medium | 0.09792469558666919 | https://leetcode.com/problems/longest-absolute-file-path |
| 3 | 900 | RLE Iterator | 53.5% | Medium | 0.08010604232504882 | https://leetcode.com/problems/rle-iterator |
| 4 | 616 | Add Bold Tag in String | 43.1% | Medium | 0.05421381659414747 | https://leetcode.com/problems/add-bold-tag-in-string |
| 5 | 695 | Max Area of Island | 62.7% | Medium | 0.028321590863246118 | https://leetcode.com/problems/max-area-of-island |
| 6 | 96 | Unique Binary Search Trees | 52.9% | Medium | 0.02067613283842731 | https://leetcode.com/problems/unique-binary-search-trees |
| 7 | 37 | Sudoku Solver | 43.6% | Hard | 0.01821543989134118 | https://leetcode.com/problems/sudoku-solver |
| 8 | 314 | Binary Tree Vertical Order Traversal | 45.3% | Medium | 0.018010392274465332 | https://leetcode.com/problems/binary-tree-vertical-order-traversal |
| 9 | 239 | Sliding Window Maximum | 43.0% | Hard | 0.01768566434627554 | https://leetcode.com/problems/sliding-window-maximum |
| 10 | 340 | Longest Substring with At Most K Distinct Characters | 44.1% | Hard | 0.016122880486563188 | https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters |
| 11 | 528 | Random Pick with Weight | 43.9% | Medium | 0.014831565905995232 | https://leetcode.com/problems/random-pick-with-weight |
| 12 | 41 | First Missing Positive | 32.0% | Hard | 0.014368063266920193 | https://leetcode.com/problems/first-missing-positive |
| 13 | 172 | Factorial Trailing Zeroes | 37.8% | Easy | 0.012326812480658571 | https://leetcode.com/problems/factorial-trailing-zeroes |
| 14 | 153 | Find Minimum in Rotated Sorted Array | 45.1% | Medium | 0.008430963288799368 | https://leetcode.com/problems/find-minimum-in-rotated-sorted-array |
| 15 | 6 | ZigZag Conversion | 36.3% | Medium | 0.0077116248757144665 | https://leetcode.com/problems/zigzag-conversion |
| 16 | 200 | Number of Islands | 46.8% | Medium | 0.006490251382779317 | https://leetcode.com/problems/number-of-islands |
| 17 | 64 | Minimum Path Sum | 54.5% | Medium | 0.006127470152097104 | https://leetcode.com/problems/minimum-path-sum |
| 18 | 207 | Course Schedule | 43.1% | Medium | 0.004964021114211758 | https://leetcode.com/problems/course-schedule |
| 19 | 155 | Min Stack | 44.5% | Easy | 0.00474891074128171 | https://leetcode.com/problems/min-stack |
| 20 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.004051459000748015 | https://leetcode.com/problems/merge-k-sorted-lists |
| 21 | 49 | Group Anagrams | 56.9% | Medium | 0.0038040939835560453 | https://leetcode.com/problems/group-anagrams |