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)
```
6.1 KiB
6.1 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 366 | Find Leaves of Binary Tree | 70.6% | Medium | 0.5289140003341137 | https://leetcode.com/problems/find-leaves-of-binary-tree |
| 3 | 981 | Time Based Key-Value Store | 53.1% | Medium | 0.40162982547051973 | https://leetcode.com/problems/time-based-key-value-store |
| 4 | 860 | Lemonade Change | 51.6% | Easy | 0.3967602828188025 | https://leetcode.com/problems/lemonade-change |
| 5 | 1120 | Maximum Average Subtree | 61.9% | Medium | 0.2694761079552085 | https://leetcode.com/problems/maximum-average-subtree |
| 6 | 1071 | Greatest Common Divisor of Strings | 52.9% | Easy | 0.25580276615686737 | https://leetcode.com/problems/greatest-common-divisor-of-strings |
| 7 | 821 | Shortest Distance to a Character | 66.9% | Easy | 0.24320527953164725 | https://leetcode.com/problems/shortest-distance-to-a-character |
| 8 | 17 | Letter Combinations of a Phone Number | 46.8% | Medium | 0.22166457131988548 | https://leetcode.com/problems/letter-combinations-of-a-phone-number |
| 9 | 362 | Design Hit Counter | 63.7% | Medium | 0.20812125379246896 | https://leetcode.com/problems/design-hit-counter |
| 10 | 253 | Meeting Rooms II | 45.7% | Medium | 0.12203276379668937 | https://leetcode.com/problems/meeting-rooms-ii |
| 11 | 284 | Peeking Iterator | 45.7% | Medium | 0.11901099827011974 | https://leetcode.com/problems/peeking-iterator |
| 12 | 1223 | Dice Roll Simulation | 45.6% | Medium | 0.10212949507637983 | https://leetcode.com/problems/dice-roll-simulation |
| 13 | 300 | Longest Increasing Subsequence | 42.6% | Medium | 0.10155280044326445 | https://leetcode.com/problems/longest-increasing-subsequence |
| 14 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.09666556212354038 | https://leetcode.com/problems/merge-k-sorted-lists |
| 15 | 20 | Valid Parentheses | 39.0% | Easy | 0.09286263438126167 | https://leetcode.com/problems/valid-parentheses |
| 16 | 359 | Logger Rate Limiter | 70.8% | Easy | 0.08167803101426718 | https://leetcode.com/problems/logger-rate-limiter |
| 17 | 1366 | Rank Teams by Votes | 53.8% | Medium | 0.07223355735937158 | https://leetcode.com/problems/rank-teams-by-votes |
| 18 | 200 | Number of Islands | 46.8% | Medium | 0.06985103785996453 | https://leetcode.com/problems/number-of-islands |
| 19 | 706 | Design HashMap | 61.3% | Easy | 0.0683442674369718 | https://leetcode.com/problems/design-hashmap |
| 20 | 98 | Validate Binary Search Tree | 27.8% | Medium | 0.057985181512132535 | https://leetcode.com/problems/validate-binary-search-tree |
| 21 | 540 | Single Element in a Sorted Array | 57.9% | Medium | 0.042721256704769804 | https://leetcode.com/problems/single-element-in-a-sorted-array |
| 22 | 844 | Backspace String Compare | 46.4% | Easy | 0.041499730906752734 | https://leetcode.com/problems/backspace-string-compare |
| 23 | 31 | Next Permutation | 32.6% | Medium | 0.03686102113159897 | https://leetcode.com/problems/next-permutation |
| 24 | 394 | Decode String | 50.0% | Medium | 0.03227387813668991 | https://leetcode.com/problems/decode-string |
| 25 | 150 | Evaluate Reverse Polish Notation | 36.3% | Medium | 0.031526253646773944 | https://leetcode.com/problems/evaluate-reverse-polish-notation |
| 26 | 547 | Friend Circles | 58.6% | Medium | 0.027307522052851193 | https://leetcode.com/problems/friend-circles |
| 27 | 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 |
| 28 | 713 | Subarray Product Less Than K | 39.1% | Medium | 0.02473842915612247 | https://leetcode.com/problems/subarray-product-less-than-k |
| 29 | 647 | Palindromic Substrings | 60.6% | Medium | 0.023250853650202817 | https://leetcode.com/problems/palindromic-substrings |
| 30 | 199 | Binary Tree Right Side View | 54.1% | Medium | 0.022539339846061532 | https://leetcode.com/problems/binary-tree-right-side-view |
| 31 | 101 | Symmetric Tree | 46.8% | Easy | 0.02109782896463587 | https://leetcode.com/problems/symmetric-tree |
| 32 | 341 | Flatten Nested List Iterator | 52.9% | Medium | 0.019980684690483426 | https://leetcode.com/problems/flatten-nested-list-iterator |
| 33 | 53 | Maximum Subarray | 46.5% | Easy | 0.019336728821707075 | https://leetcode.com/problems/maximum-subarray |
| 34 | 173 | Binary Search Tree Iterator | 56.6% | Medium | 0.01899993824490396 | https://leetcode.com/problems/binary-search-tree-iterator |
| 35 | 872 | Leaf-Similar Trees | 64.5% | Easy | 0.01752125418714782 | https://leetcode.com/problems/leaf-similar-trees |
| 36 | 46 | Permutations | 63.5% | Medium | 0.016759583649075344 | https://leetcode.com/problems/permutations |
| 37 | 680 | Valid Palindrome II | 36.6% | Easy | 0.01632541245860885 | https://leetcode.com/problems/valid-palindrome-ii |
| 38 | 701 | Insert into a Binary Search Tree | 77.7% | Medium | 0.015522236371561826 | https://leetcode.com/problems/insert-into-a-binary-search-tree |
| 39 | 528 | Random Pick with Weight | 43.9% | Medium | 0.014831565905995232 | https://leetcode.com/problems/random-pick-with-weight |
| 40 | 227 | Basic Calculator II | 36.9% | Medium | 0.01239941490503826 | https://leetcode.com/problems/basic-calculator-ii |
| 41 | 543 | Diameter of Binary Tree | 48.4% | Easy | 0.011898606798495848 | https://leetcode.com/problems/diameter-of-binary-tree |
| 42 | 3 | Longest Substring Without Repeating Characters | 30.4% | Medium | 0.009683242444739549 | https://leetcode.com/problems/longest-substring-without-repeating-characters |
| 43 | 295 | Find Median from Data Stream | 44.3% | Hard | 0.00899893586856953 | https://leetcode.com/problems/find-median-from-data-stream |
| 44 | 21 | Merge Two Sorted Lists | 53.5% | Easy | 0.008990339814651234 | https://leetcode.com/problems/merge-two-sorted-lists |
| 45 | 215 | Kth Largest Element in an Array | 55.4% | Medium | 0.008759180089881562 | https://leetcode.com/problems/kth-largest-element-in-an-array |
| 46 | 78 | Subsets | 62.0% | Medium | 0.008278192969371254 | https://leetcode.com/problems/subsets |
| 47 | 102 | Binary Tree Level Order Traversal | 54.6% | Medium | 0.008169238497129479 | https://leetcode.com/problems/binary-tree-level-order-traversal |
| 48 | 692 | Top K Frequent Words | 51.8% | Medium | 0.007516006820935329 | https://leetcode.com/problems/top-k-frequent-words |
| 49 | 136 | Single Number | 65.5% | Easy | 0.006445166968713385 | https://leetcode.com/problems/single-number |
| 50 | 121 | Best Time to Buy and Sell Stock | 50.5% | Easy | 0.0047725193990346675 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock |
| 51 | 236 | Lowest Common Ancestor of a Binary Tree | 45.7% | Medium | 0.004714210262726446 | https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree |
| 52 | 22 | Generate Parentheses | 62.7% | Medium | 0.0043611059090124735 | https://leetcode.com/problems/generate-parentheses |
| 53 | 56 | Merge Intervals | 39.3% | Medium | 0.0034728286335985107 | https://leetcode.com/problems/merge-intervals |
| 54 | 1307 | Verbal Arithmetic Puzzle | 37.7% | Hard | 0 | https://leetcode.com/problems/verbal-arithmetic-puzzle |