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)
```
3.3 KiB
3.3 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 845 | Longest Mountain in Array | 37.2% | Medium | 0.2744088602461735 | https://leetcode.com/problems/longest-mountain-in-array |
| 3 | 388 | Longest Absolute File Path | 41.8% | Medium | 0.18128582392042256 | https://leetcode.com/problems/longest-absolute-file-path |
| 4 | 900 | RLE Iterator | 53.5% | Medium | 0.08816278759467164 | https://leetcode.com/problems/rle-iterator |
| 5 | 616 | Add Bold Tag in String | 43.1% | Medium | 0.05421381659414747 | https://leetcode.com/problems/add-bold-tag-in-string |
| 6 | 695 | Max Area of Island | 62.7% | Medium | 0.04980799142417255 | https://leetcode.com/problems/max-area-of-island |
| 7 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.04853398505532907 | https://leetcode.com/problems/merge-k-sorted-lists |
| 8 | 528 | Random Pick with Weight | 43.9% | Medium | 0.03306693626657339 | https://leetcode.com/problems/random-pick-with-weight |
| 9 | 56 | Merge Intervals | 39.3% | Medium | 0.02150990613527447 | https://leetcode.com/problems/merge-intervals |
| 10 | 96 | Unique Binary Search Trees | 52.9% | Medium | 0.02067613283842731 | https://leetcode.com/problems/unique-binary-search-trees |
| 11 | 155 | Min Stack | 44.5% | Easy | 0.01886181109797383 | https://leetcode.com/problems/min-stack |
| 12 | 37 | Sudoku Solver | 43.6% | Hard | 0.01821543989134118 | https://leetcode.com/problems/sudoku-solver |
| 13 | 314 | Binary Tree Vertical Order Traversal | 45.3% | Medium | 0.018010392274465332 | https://leetcode.com/problems/binary-tree-vertical-order-traversal |
| 14 | 239 | Sliding Window Maximum | 43.0% | Hard | 0.01768566434627554 | https://leetcode.com/problems/sliding-window-maximum |
| 15 | 42 | Trapping Rain Water | 48.9% | Hard | 0.017290251352643615 | https://leetcode.com/problems/trapping-rain-water |
| 16 | 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 |
| 17 | 49 | Group Anagrams | 56.9% | Medium | 0.01513031227798415 | https://leetcode.com/problems/group-anagrams |
| 18 | 41 | First Missing Positive | 32.0% | Hard | 0.014368063266920193 | https://leetcode.com/problems/first-missing-positive |
| 19 | 172 | Factorial Trailing Zeroes | 37.8% | Easy | 0.012326812480658571 | https://leetcode.com/problems/factorial-trailing-zeroes |
| 20 | 200 | Number of Islands | 46.8% | Medium | 0.011509262420590827 | https://leetcode.com/problems/number-of-islands |
| 21 | 48 | Rotate Image | 56.7% | Medium | 0.011428695823622754 | https://leetcode.com/problems/rotate-image |
| 22 | 128 | Longest Consecutive Sequence | 45.1% | Hard | 0.009051883485315484 | https://leetcode.com/problems/longest-consecutive-sequence |
| 23 | 153 | Find Minimum in Rotated Sorted Array | 45.1% | Medium | 0.008430963288799368 | https://leetcode.com/problems/find-minimum-in-rotated-sorted-array |
| 24 | 6 | ZigZag Conversion | 36.3% | Medium | 0.0077116248757144665 | https://leetcode.com/problems/zigzag-conversion |
| 25 | 64 | Minimum Path Sum | 54.5% | Medium | 0.006127470152097104 | https://leetcode.com/problems/minimum-path-sum |
| 26 | 207 | Course Schedule | 43.1% | Medium | 0.004964021114211758 | https://leetcode.com/problems/course-schedule |
| 27 | 146 | LRU Cache | 33.2% | Medium | 0.004600353139061353 | https://leetcode.com/problems/lru-cache |
| 28 | 560 | Subarray Sum Equals K | 43.9% | Medium | 0.004279454482267064 | https://leetcode.com/problems/subarray-sum-equals-k |
| 29 | 125 | Valid Palindrome | 36.7% | Easy | 0.0039805008274065926 | https://leetcode.com/problems/valid-palindrome |
| 30 | 2 | Add Two Numbers | 33.9% | Medium | 0.0016886191111440908 | https://leetcode.com/problems/add-two-numbers |
| 31 | 1 | Two Sum | 45.6% | Easy | 0.0008206138651873125 | https://leetcode.com/problems/two-sum |