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