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.9 KiB
3.9 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 991 | Broken Calculator | 45.6% | Medium | 0.8343103907872829 | https://leetcode.com/problems/broken-calculator |
| 3 | 1052 | Grumpy Bookstore Owner | 55.4% | Medium | 0.6329062363392213 | https://leetcode.com/problems/grumpy-bookstore-owner |
| 4 | 45 | Jump Game II | 30.6% | Hard | 0.4315020818911597 | https://leetcode.com/problems/jump-game-ii |
| 5 | 457 | Circular Array Loop | 29.4% | Medium | 0.31790921708384473 | https://leetcode.com/problems/circular-array-loop |
| 6 | 403 | Frog Jump | 39.7% | Hard | 0.1519909531790461 | https://leetcode.com/problems/frog-jump |
| 7 | 402 | Remove K Digits | 28.4% | Medium | 0.14242034004176865 | https://leetcode.com/problems/remove-k-digits |
| 8 | 826 | Most Profit Assigning Work | 38.5% | Medium | 0.09287412500644375 | https://leetcode.com/problems/most-profit-assigning-work |
| 9 | 564 | Find the Closest Palindrome | 19.7% | Hard | 0.0840831172105414 | https://leetcode.com/problems/find-the-closest-palindrome |
| 10 | 273 | Integer to English Words | 27.1% | Hard | 0.04747257415466348 | https://leetcode.com/problems/integer-to-english-words |
| 11 | 703 | Kth Largest Element in a Stream | 49.7% | Easy | 0.031004894819414507 | https://leetcode.com/problems/kth-largest-element-in-a-stream |
| 12 | 316 | Remove Duplicate Letters | 35.8% | Hard | 0.030443751414723153 | https://leetcode.com/problems/remove-duplicate-letters |
| 13 | 33 | Search in Rotated Sorted Array | 34.5% | Medium | 0.0287009496170278 | https://leetcode.com/problems/search-in-rotated-sorted-array |
| 14 | 202 | Happy Number | 50.4% | Easy | 0.02483442856330386 | https://leetcode.com/problems/happy-number |
| 15 | 55 | Jump Game | 34.6% | Medium | 0.01994084020351079 | https://leetcode.com/problems/jump-game |
| 16 | 253 | Meeting Rooms II | 45.7% | Medium | 0.018087309810579388 | https://leetcode.com/problems/meeting-rooms-ii |
| 17 | 17 | Letter Combinations of a Phone Number | 46.8% | Medium | 0.017492519932499718 | https://leetcode.com/problems/letter-combinations-of-a-phone-number |
| 18 | 238 | Product of Array Except Self | 60.1% | Medium | 0.015629897160874744 | https://leetcode.com/problems/product-of-array-except-self |
| 19 | 210 | Course Schedule II | 40.7% | Medium | 0.011869857339029215 | https://leetcode.com/problems/course-schedule-ii |
| 20 | 207 | Course Schedule | 43.1% | Medium | 0.01113459480911671 | https://leetcode.com/problems/course-schedule |
| 21 | 22 | Generate Parentheses | 62.7% | Medium | 0.009785877810632554 | https://leetcode.com/problems/generate-parentheses |
| 22 | 40 | Combination Sum II | 48.2% | Medium | 0.009578617297069781 | https://leetcode.com/problems/combination-sum-ii |
| 23 | 208 | Implement Trie (Prefix Tree) | 49.4% | Medium | 0.009105457856626612 | https://leetcode.com/problems/implement-trie-prefix-tree |
| 24 | 128 | Longest Consecutive Sequence | 45.1% | Hard | 0.009051883485315484 | https://leetcode.com/problems/longest-consecutive-sequence |
| 25 | 977 | Squares of a Sorted Array | 72.1% | Easy | 0.008733679968754604 | https://leetcode.com/problems/squares-of-a-sorted-array |
| 26 | 239 | Sliding Window Maximum | 43.0% | Hard | 0.007898935224534491 | https://leetcode.com/problems/sliding-window-maximum |
| 27 | 116 | Populating Next Right Pointers in Each Node | 45.2% | Medium | 0.007336790063854334 | https://leetcode.com/problems/populating-next-right-pointers-in-each-node |
| 28 | 200 | Number of Islands | 46.8% | Medium | 0.006490251382779317 | https://leetcode.com/problems/number-of-islands |
| 29 | 76 | Minimum Window Substring | 34.6% | Hard | 0.006231520398723243 | https://leetcode.com/problems/minimum-window-substring |
| 30 | 138 | Copy List with Random Pointer | 36.4% | Medium | 0.006191011880825271 | https://leetcode.com/problems/copy-list-with-random-pointer |
| 31 | 621 | Task Scheduler | 50.1% | Medium | 0.005261323957171611 | https://leetcode.com/problems/task-scheduler |
| 32 | 146 | LRU Cache | 33.2% | Medium | 0.004600353139061353 | https://leetcode.com/problems/lru-cache |
| 33 | 234 | Palindrome Linked List | 39.3% | Easy | 0.004533613114828982 | https://leetcode.com/problems/palindrome-linked-list |
| 34 | 49 | Group Anagrams | 56.9% | Medium | 0.0038040939835560453 | https://leetcode.com/problems/group-anagrams |
| 35 | 283 | Move Zeroes | 57.8% | Easy | 0.0028853803470673955 | https://leetcode.com/problems/move-zeroes |
| 36 | 5 | Longest Palindromic Substring | 29.5% | Medium | 0.002279333142507479 | https://leetcode.com/problems/longest-palindromic-substring |