mirror of
https://github.com/McSmog/LeetCode-Questions-CompanyWise.git
synced 2026-04-19 16:56:45 +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)
```
5.6 KiB
5.6 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 735 | Asteroid Collision | 41.0% | Medium | 2.8217088979664124 | https://leetcode.com/problems/asteroid-collision |
| 3 | 716 | Max Stack | 42.6% | Easy | 2.0561349637374544 | https://leetcode.com/problems/max-stack |
| 4 | 238 | Product of Array Except Self | 60.1% | Medium | 1.9880213444075543 | https://leetcode.com/problems/product-of-array-except-self |
| 5 | 158 | Read N Characters Given Read4 II - Call multiple times | 33.8% | Hard | 1.2224474101785963 | https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times |
| 6 | 981 | Time Based Key-Value Store | 53.1% | Medium | 1.1090620945258824 | https://leetcode.com/problems/time-based-key-value-store |
| 7 | 642 | Design Search Autocomplete System | 44.7% | Hard | 0.9534648850908103 | https://leetcode.com/problems/design-search-autocomplete-system |
| 8 | 365 | Water and Jug Problem | 30.6% | Medium | 0.8801037398580485 | https://leetcode.com/problems/water-and-jug-problem |
| 9 | 127 | Word Ladder | 29.6% | Medium | 0.4325804000994867 | https://leetcode.com/problems/word-ladder |
| 10 | 42 | Trapping Rain Water | 48.9% | Hard | 0.36187179404352093 | https://leetcode.com/problems/trapping-rain-water |
| 11 | 200 | Number of Islands | 46.8% | Medium | 0.3002278451426276 | https://leetcode.com/problems/number-of-islands |
| 12 | 349 | Intersection of Two Arrays | 62.5% | Easy | 0.23266691552464092 | https://leetcode.com/problems/intersection-of-two-arrays |
| 13 | 251 | Flatten 2D Vector | 45.7% | Medium | 0.14355814329423544 | https://leetcode.com/problems/flatten-2d-vector |
| 14 | 426 | Convert Binary Search Tree to Sorted Doubly Linked List | 59.1% | Medium | 0.14252878462127264 | https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list |
| 15 | 279 | Perfect Squares | 47.4% | Medium | 0.13815033848081718 | https://leetcode.com/problems/perfect-squares |
| 16 | 333 | Largest BST Subtree | 35.8% | Medium | 0.13138400282910845 | https://leetcode.com/problems/largest-bst-subtree |
| 17 | 304 | Range Sum Query 2D - Immutable | 38.6% | Medium | 0.11875551458160917 | https://leetcode.com/problems/range-sum-query-2d-immutable |
| 18 | 652 | Find Duplicate Subtrees | 50.2% | Medium | 0.08907963005368878 | https://leetcode.com/problems/find-duplicate-subtrees |
| 19 | 109 | Convert Sorted List to Binary Search Tree | 47.7% | Medium | 0.08701137698962977 | https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree |
| 20 | 76 | Minimum Window Substring | 34.6% | Hard | 0.07378420845373558 | https://leetcode.com/problems/minimum-window-substring |
| 21 | 91 | Decode Ways | 24.7% | Medium | 0.07076721180832166 | https://leetcode.com/problems/decode-ways |
| 22 | 68 | Text Justification | 27.7% | Hard | 0.06116036187169583 | https://leetcode.com/problems/text-justification |
| 23 | 10 | Regular Expression Matching | 26.8% | Hard | 0.04409107726484965 | https://leetcode.com/problems/regular-expression-matching |
| 24 | 22 | Generate Parentheses | 62.7% | Medium | 0.038581724751038625 | https://leetcode.com/problems/generate-parentheses |
| 25 | 694 | Number of Distinct Islands | 56.0% | Medium | 0.03278982282299087 | https://leetcode.com/problems/number-of-distinct-islands |
| 26 | 17 | Letter Combinations of a Phone Number | 46.8% | Medium | 0.027199239804368825 | https://leetcode.com/problems/letter-combinations-of-a-phone-number |
| 27 | 442 | Find All Duplicates in an Array | 67.8% | Medium | 0.02608087555279249 | https://leetcode.com/problems/find-all-duplicates-in-an-array |
| 28 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.0250564321052577 | https://leetcode.com/problems/merge-k-sorted-lists |
| 29 | 20 | Valid Parentheses | 39.0% | Easy | 0.020517047266669974 | https://leetcode.com/problems/valid-parentheses |
| 30 | 48 | Rotate Image | 56.7% | Medium | 0.020228249775471566 | https://leetcode.com/problems/rotate-image |
| 31 | 341 | Flatten Nested List Iterator | 52.9% | Medium | 0.019980684690483426 | https://leetcode.com/problems/flatten-nested-list-iterator |
| 32 | 146 | LRU Cache | 33.2% | Medium | 0.01827577993873683 | https://leetcode.com/problems/lru-cache |
| 33 | 253 | Meeting Rooms II | 45.7% | Medium | 0.018087309810579388 | https://leetcode.com/problems/meeting-rooms-ii |
| 34 | 126 | Word Ladder II | 22.1% | Hard | 0.017994187717865196 | https://leetcode.com/problems/word-ladder-ii |
| 35 | 239 | Sliding Window Maximum | 43.0% | Hard | 0.01768566434627554 | https://leetcode.com/problems/sliding-window-maximum |
| 36 | 1060 | Missing Element in Sorted Array | 54.5% | Medium | 0.017429635135283658 | https://leetcode.com/problems/missing-element-in-sorted-array |
| 37 | 7 | Reverse Integer | 25.8% | Easy | 0.016627790608488954 | https://leetcode.com/problems/reverse-integer |
| 38 | 567 | Permutation in String | 44.4% | Medium | 0.014947961435873182 | https://leetcode.com/problems/permutation-in-string |
| 39 | 162 | Find Peak Element | 43.3% | Medium | 0.014231739257256364 | https://leetcode.com/problems/find-peak-element |
| 40 | 88 | Merge Sorted Array | 39.4% | Easy | 0.011986958032982505 | https://leetcode.com/problems/merge-sorted-array |
| 41 | 69 | Sqrt(x) | 33.9% | Easy | 0.011443227222342794 | https://leetcode.com/problems/sqrtx |
| 42 | 78 | Subsets | 62.0% | Medium | 0.008278192969371254 | https://leetcode.com/problems/subsets |
| 43 | 11 | Container With Most Water | 50.8% | Medium | 0.006889188300412141 | https://leetcode.com/problems/container-with-most-water |
| 44 | 24 | Swap Nodes in Pairs | 50.4% | Medium | 0.0062218275061505365 | https://leetcode.com/problems/swap-nodes-in-pairs |
| 45 | 155 | Min Stack | 44.5% | Easy | 0.00474891074128171 | https://leetcode.com/problems/min-stack |
| 46 | 283 | Move Zeroes | 57.8% | Easy | 0.0028853803470673955 | https://leetcode.com/problems/move-zeroes |
| 47 | 21 | Merge Two Sorted Lists | 53.5% | Easy | 0.0022551737583973706 | https://leetcode.com/problems/merge-two-sorted-lists |
| 48 | 121 | Best Time to Buy and Sell Stock | 50.5% | Easy | 0.0021239321954525975 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock |
| 49 | 2 | Add Two Numbers | 33.9% | Medium | 0.0016886191111440908 | https://leetcode.com/problems/add-two-numbers |
| 50 | 79 | Word Search | 35.6% | Medium | 0.0016647248725526849 | https://leetcode.com/problems/word-search |
| 51 | 1 | Two Sum | 45.6% | Easy | 0.0008206138651873125 | https://leetcode.com/problems/two-sum |