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 | 829 | Consecutive Numbers Sum | 37.5% | Hard | 1.0192107113585394 | https://leetcode.com/problems/consecutive-numbers-sum |
| 3 | 1048 | Longest String Chain | 54.7% | Medium | 0.6021288528371614 | https://leetcode.com/problems/longest-string-chain |
| 4 | 285 | Inorder Successor in BST | 40.4% | Medium | 0.1850469943157836 | https://leetcode.com/problems/inorder-successor-in-bst |
| 5 | 241 | Different Ways to Add Parentheses | 55.2% | Medium | 0.14691814457724592 | https://leetcode.com/problems/different-ways-to-add-parentheses |
| 6 | 647 | Palindromic Substrings | 60.6% | Medium | 0.1205091763778271 | https://leetcode.com/problems/palindromic-substrings |
| 7 | 935 | Knight Dialer | 45.2% | Medium | 0.04445176257083384 | https://leetcode.com/problems/knight-dialer |
| 8 | 32 | Longest Valid Parentheses | 28.4% | Hard | 0.03595893038744387 | https://leetcode.com/problems/longest-valid-parentheses |
| 9 | 332 | Reconstruct Itinerary | 36.7% | Medium | 0.030687713231237448 | https://leetcode.com/problems/reconstruct-itinerary |
| 10 | 20 | Valid Parentheses | 39.0% | Easy | 0.02782373445001039 | https://leetcode.com/problems/valid-parentheses |
| 11 | 42 | Trapping Rain Water | 48.9% | Hard | 0.02688623073425064 | https://leetcode.com/problems/trapping-rain-water |
| 12 | 221 | Maximal Square | 37.7% | Medium | 0.022108490754203434 | https://leetcode.com/problems/maximal-square |
| 13 | 239 | Sliding Window Maximum | 43.0% | Hard | 0.01768566434627554 | https://leetcode.com/problems/sliding-window-maximum |
| 14 | 240 | Search a 2D Matrix II | 43.2% | Medium | 0.0169815401480941 | https://leetcode.com/problems/search-a-2d-matrix-ii |
| 15 | 628 | Maximum Product of Three Numbers | 47.1% | Easy | 0.016529301951210565 | https://leetcode.com/problems/maximum-product-of-three-numbers |
| 16 | 225 | Implement Stack using Queues | 45.1% | Easy | 0.01644097863345757 | https://leetcode.com/problems/implement-stack-using-queues |
| 17 | 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 |
| 18 | 85 | Maximal Rectangle | 37.7% | Hard | 0.013333530869465187 | https://leetcode.com/problems/maximal-rectangle |
| 19 | 232 | Implement Queue using Stacks | 49.6% | Easy | 0.011242389348933884 | https://leetcode.com/problems/implement-queue-using-stacks |
| 20 | 146 | LRU Cache | 33.2% | Medium | 0.010321192540274932 | https://leetcode.com/problems/lru-cache |
| 21 | 212 | Word Search II | 34.9% | Hard | 0.009845021678804893 | https://leetcode.com/problems/word-search-ii |
| 22 | 295 | Find Median from Data Stream | 44.3% | Hard | 0.00899893586856953 | https://leetcode.com/problems/find-median-from-data-stream |
| 23 | 253 | Meeting Rooms II | 45.7% | Medium | 0.008079219870546493 | https://leetcode.com/problems/meeting-rooms-ii |
| 24 | 297 | Serialize and Deserialize Binary Tree | 47.5% | Hard | 0.007077170374085099 | https://leetcode.com/problems/serialize-and-deserialize-binary-tree |
| 25 | 15 | 3Sum | 26.8% | Medium | 0.004940992758742591 | https://leetcode.com/problems/3sum |
| 26 | 121 | Best Time to Buy and Sell Stock | 50.5% | Easy | 0.0047725193990346675 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock |
| 27 | 28 | Implement strStr() | 34.5% | Easy | 0.003943222775040032 | https://leetcode.com/problems/implement-strstr |
| 28 | 200 | Number of Islands | 46.8% | Medium | 0.0028897578265903614 | https://leetcode.com/problems/number-of-islands |
| 29 | 53 | Maximum Subarray | 46.5% | Easy | 0.002167082872150794 | https://leetcode.com/problems/maximum-subarray |
| 30 | 70 | Climbing Stairs | 47.8% | Easy | 0.0015084665529624085 | https://leetcode.com/problems/climbing-stairs |