mirror of
https://github.com/McSmog/LeetCode-Questions-CompanyWise.git
synced 2026-04-19 08:46: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)
```
4.7 KiB
4.7 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 974 | Subarray Sums Divisible by K | 48.9% | Medium | 0.23897880752617776 | https://leetcode.com/problems/subarray-sums-divisible-by-k |
| 3 | 1283 | Find the Smallest Divisor Given a Threshold | 47.6% | Medium | 0.17884755718277986 | https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold |
| 4 | 443 | String Compression | 41.3% | Easy | 0.11871630683938197 | https://leetcode.com/problems/string-compression |
| 5 | 713 | Subarray Product Less Than K | 39.1% | Medium | 0.09548093997208476 | https://leetcode.com/problems/subarray-product-less-than-k |
| 6 | 973 | K Closest Points to Origin | 63.8% | Medium | 0.08860246722187161 | https://leetcode.com/problems/k-closest-points-to-origin |
| 7 | 884 | Uncommon Words from Two Sentences | 63.3% | Easy | 0.07990051073053109 | https://leetcode.com/problems/uncommon-words-from-two-sentences |
| 8 | 33 | Search in Rotated Sorted Array | 34.5% | Medium | 0.07777550022464022 | https://leetcode.com/problems/search-in-rotated-sorted-array |
| 9 | 20 | Valid Parentheses | 39.0% | Easy | 0.06735240264428982 | https://leetcode.com/problems/valid-parentheses |
| 10 | 146 | LRU Cache | 33.2% | Medium | 0.040660598211268925 | https://leetcode.com/problems/lru-cache |
| 11 | 200 | Number of Islands | 46.8% | Medium | 0.03483682053721545 | https://leetcode.com/problems/number-of-islands |
| 12 | 724 | Find Pivot Index | 44.0% | Easy | 0.03089844155123413 | https://leetcode.com/problems/find-pivot-index |
| 13 | 451 | Sort Characters By Frequency | 63.0% | Medium | 0.029356315510965035 | https://leetcode.com/problems/sort-characters-by-frequency |
| 14 | 297 | Serialize and Deserialize Binary Tree | 47.5% | Hard | 0.028013036227673965 | https://leetcode.com/problems/serialize-and-deserialize-binary-tree |
| 15 | 295 | Find Median from Data Stream | 44.3% | Hard | 0.0201349084090559 | https://leetcode.com/problems/find-median-from-data-stream |
| 16 | 37 | Sudoku Solver | 43.6% | Hard | 0.01821543989134118 | https://leetcode.com/problems/sudoku-solver |
| 17 | 314 | Binary Tree Vertical Order Traversal | 45.3% | Medium | 0.018010392274465332 | https://leetcode.com/problems/binary-tree-vertical-order-traversal |
| 18 | 692 | Top K Frequent Words | 51.8% | Medium | 0.016832265743172113 | https://leetcode.com/problems/top-k-frequent-words |
| 19 | 73 | Set Matrix Zeroes | 43.1% | Medium | 0.015715357479628243 | https://leetcode.com/problems/set-matrix-zeroes |
| 20 | 198 | House Robber | 42.0% | Easy | 0.014946565030639177 | https://leetcode.com/problems/house-robber |
| 21 | 404 | Sum of Left Leaves | 50.9% | Easy | 0.013981353230340547 | https://leetcode.com/problems/sum-of-left-leaves |
| 22 | 138 | Copy List with Random Pointer | 36.4% | Medium | 0.013876263355766411 | https://leetcode.com/problems/copy-list-with-random-pointer |
| 23 | 134 | Gas Station | 38.5% | Medium | 0.01352742981715631 | https://leetcode.com/problems/gas-station |
| 24 | 88 | Merge Sorted Array | 39.4% | Easy | 0.011986958032982505 | https://leetcode.com/problems/merge-sorted-array |
| 25 | 160 | Intersection of Two Linked Lists | 40.6% | Easy | 0.010994491398666248 | https://leetcode.com/problems/intersection-of-two-linked-lists |
| 26 | 739 | Daily Temperatures | 63.3% | Medium | 0.010032690121814417 | https://leetcode.com/problems/daily-temperatures |
| 27 | 1 | Two Sum | 45.6% | Easy | 0.010006414028595919 | https://leetcode.com/problems/two-sum |
| 28 | 242 | Valid Anagram | 56.9% | Easy | 0.009322628116274939 | https://leetcode.com/problems/valid-anagram |
| 29 | 96 | Unique Binary Search Trees | 52.9% | Medium | 0.009242209964820877 | https://leetcode.com/problems/unique-binary-search-trees |
| 30 | 43 | Multiply Strings | 33.9% | Medium | 0.009145011150062768 | https://leetcode.com/problems/multiply-strings |
| 31 | 53 | Maximum Subarray | 46.5% | Easy | 0.008640295679602939 | https://leetcode.com/problems/maximum-subarray |
| 32 | 121 | Best Time to Buy and Sell Stock | 50.5% | Easy | 0.00846879565300311 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock |
| 33 | 253 | Meeting Rooms II | 45.7% | Medium | 0.008079219870546493 | https://leetcode.com/problems/meeting-rooms-ii |
| 34 | 240 | Search a 2D Matrix II | 43.2% | Medium | 0.0075829747244553335 | https://leetcode.com/problems/search-a-2d-matrix-ii |
| 35 | 3 | Longest Substring Without Repeating Characters | 30.4% | Medium | 0.006208067119374334 | https://leetcode.com/problems/longest-substring-without-repeating-characters |
| 36 | 127 | Word Ladder | 29.6% | Medium | 0.005979091056058075 | https://leetcode.com/problems/word-ladder |
| 37 | 91 | Decode Ways | 24.7% | Medium | 0.005968385368349129 | https://leetcode.com/problems/decode-ways |
| 38 | 167 | Two Sum II - Input array is sorted | 54.1% | Easy | 0.005507380022589096 | https://leetcode.com/problems/two-sum-ii-input-array-is-sorted |
| 39 | 560 | Subarray Sum Equals K | 43.9% | Medium | 0.004279454482267064 | https://leetcode.com/problems/subarray-sum-equals-k |
| 40 | 215 | Kth Largest Element in an Array | 55.4% | Medium | 0.003902443976931749 | https://leetcode.com/problems/kth-largest-element-in-an-array |
| 41 | 102 | Binary Tree Level Order Traversal | 54.6% | Medium | 0.003639014205004082 | https://leetcode.com/problems/binary-tree-level-order-traversal |
| 42 | 15 | 3Sum | 26.8% | Medium | 0.0021990113314367685 | https://leetcode.com/problems/3sum |