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)
```
4.8 KiB
4.8 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 829 | Consecutive Numbers Sum | 37.5% | Hard | 1.7290600615878309 | https://leetcode.com/problems/consecutive-numbers-sum |
| 3 | 1048 | Longest String Chain | 54.7% | Medium | 1.016830261064837 | https://leetcode.com/problems/longest-string-chain |
| 4 | 241 | Different Ways to Add Parentheses | 55.2% | Medium | 0.304600460541843 | https://leetcode.com/problems/different-ways-to-add-parentheses |
| 5 | 647 | Palindromic Substrings | 60.6% | Medium | 0.19203205445944416 | https://leetcode.com/problems/palindromic-substrings |
| 6 | 285 | Inorder Successor in BST | 40.4% | Medium | 0.1850469943157836 | https://leetcode.com/problems/inorder-successor-in-bst |
| 7 | 32 | Longest Valid Parentheses | 28.4% | Hard | 0.13667290598927465 | https://leetcode.com/problems/longest-valid-parentheses |
| 8 | 935 | Knight Dialer | 45.2% | Medium | 0.09737416402517636 | https://leetcode.com/problems/knight-dialer |
| 9 | 121 | Best Time to Buy and Sell Stock | 50.5% | Easy | 0.08602309667191627 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock |
| 10 | 42 | Trapping Rain Water | 48.9% | Hard | 0.08461041545209161 | https://leetcode.com/problems/trapping-rain-water |
| 11 | 122 | Best Time to Buy and Sell Stock II | 57.0% | Easy | 0.06582927042348097 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii |
| 12 | 221 | Maximal Square | 37.7% | Medium | 0.060244665945199054 | https://leetcode.com/problems/maximal-square |
| 13 | 20 | Valid Parentheses | 39.0% | Easy | 0.055983722381420686 | https://leetcode.com/problems/valid-parentheses |
| 14 | 295 | Find Median from Data Stream | 44.3% | Hard | 0.05495888428075748 | https://leetcode.com/problems/find-median-from-data-stream |
| 15 | 622 | Design Circular Queue | 43.7% | Medium | 0.049844204077291364 | https://leetcode.com/problems/design-circular-queue |
| 16 | 239 | Sliding Window Maximum | 43.0% | Hard | 0.0483746857022364 | https://leetcode.com/problems/sliding-window-maximum |
| 17 | 240 | Search a 2D Matrix II | 43.2% | Medium | 0.04647676584572884 | https://leetcode.com/problems/search-a-2d-matrix-ii |
| 18 | 146 | LRU Cache | 33.2% | Medium | 0.040660598211268925 | https://leetcode.com/problems/lru-cache |
| 19 | 724 | Find Pivot Index | 44.0% | Easy | 0.03089844155123413 | https://leetcode.com/problems/find-pivot-index |
| 20 | 332 | Reconstruct Itinerary | 36.7% | Medium | 0.030687713231237448 | https://leetcode.com/problems/reconstruct-itinerary |
| 21 | 123 | Best Time to Buy and Sell Stock III | 37.5% | Hard | 0.02516207671950806 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock-iii |
| 22 | 199 | Binary Tree Right Side View | 54.1% | Medium | 0.022539339846061532 | https://leetcode.com/problems/binary-tree-right-side-view |
| 23 | 105 | Construct Binary Tree from Preorder and Inorder Traversal | 48.8% | Medium | 0.022325470299025416 | https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal |
| 24 | 628 | Maximum Product of Three Numbers | 47.1% | Easy | 0.016529301951210565 | https://leetcode.com/problems/maximum-product-of-three-numbers |
| 25 | 1 | Two Sum | 45.6% | Easy | 0.016487580637467636 | https://leetcode.com/problems/two-sum |
| 26 | 225 | Implement Stack using Queues | 45.1% | Easy | 0.01644097863345757 | https://leetcode.com/problems/implement-stack-using-queues |
| 27 | 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 |
| 28 | 297 | Serialize and Deserialize Binary Tree | 47.5% | Hard | 0.01585377577217724 | https://leetcode.com/problems/serialize-and-deserialize-binary-tree |
| 29 | 15 | 3Sum | 26.8% | Medium | 0.013665148419080968 | https://leetcode.com/problems/3sum |
| 30 | 53 | Maximum Subarray | 46.5% | Easy | 0.013467854269413949 | https://leetcode.com/problems/maximum-subarray |
| 31 | 85 | Maximal Rectangle | 37.7% | Hard | 0.013333530869465187 | https://leetcode.com/problems/maximal-rectangle |
| 32 | 200 | Number of Islands | 46.8% | Medium | 0.011509262420590827 | https://leetcode.com/problems/number-of-islands |
| 33 | 232 | Implement Queue using Stacks | 49.6% | Easy | 0.011242389348933884 | https://leetcode.com/problems/implement-queue-using-stacks |
| 34 | 212 | Word Search II | 34.9% | Hard | 0.009845021678804893 | https://leetcode.com/problems/word-search-ii |
| 35 | 70 | Climbing Stairs | 47.8% | Easy | 0.009390798483527519 | https://leetcode.com/problems/climbing-stairs |
| 36 | 28 | Implement strStr() | 34.5% | Easy | 0.008850485542574548 | https://leetcode.com/problems/implement-strstr |
| 37 | 253 | Meeting Rooms II | 45.7% | Medium | 0.008079219870546493 | https://leetcode.com/problems/meeting-rooms-ii |
| 38 | 151 | Reverse Words in a String | 21.9% | Medium | 0.0061359296669270605 | https://leetcode.com/problems/reverse-words-in-a-string |
| 39 | 8 | String to Integer (atoi) | 15.4% | Medium | 0.0037925521897059712 | https://leetcode.com/problems/string-to-integer-atoi |
| 40 | 102 | Binary Tree Level Order Traversal | 54.6% | Medium | 0.003639014205004082 | https://leetcode.com/problems/binary-tree-level-order-traversal |
| 41 | 718 | Maximum Length of Repeated Subarray | 49.4% | Medium | 0 | https://leetcode.com/problems/maximum-length-of-repeated-subarray |
| 42 | 1515 | Best Position for a Service Centre | 35.9% | Hard | 0 | https://leetcode.com/problems/best-position-for-a-service-centre |