mirror of
https://github.com/krishnadey30/LeetCode-Questions-CompanyWise.git
synced 2025-12-28 13:41: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)
```
8.6 KiB
8.6 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 545 | Boundary of Binary Tree | 38.9% | Medium | 0.09349966258159505 | https://leetcode.com/problems/boundary-of-binary-tree |
| 3 | 250 | Count Univalue Subtrees | 52.0% | Medium | 0.07975881838845024 | https://leetcode.com/problems/count-univalue-subtrees |
| 4 | 244 | Shortest Word Distance II | 52.3% | Medium | 0.07622736538788424 | https://leetcode.com/problems/shortest-word-distance-ii |
| 5 | 146 | LRU Cache | 33.2% | Medium | 0.07118067822062889 | https://leetcode.com/problems/lru-cache |
| 6 | 846 | Hand of Straights | 54.2% | Medium | 0.06472423940349638 | https://leetcode.com/problems/hand-of-straights |
| 7 | 968 | Binary Tree Cameras | 37.5% | Hard | 0.05790329283155908 | https://leetcode.com/problems/binary-tree-cameras |
| 8 | 253 | Meeting Rooms II | 45.7% | Medium | 0.04945628059066218 | https://leetcode.com/problems/meeting-rooms-ii |
| 9 | 143 | Reorder List | 37.1% | Medium | 0.04554002588608351 | https://leetcode.com/problems/reorder-list |
| 10 | 1146 | Snapshot Array | 37.0% | Medium | 0.0317991816929387 | https://leetcode.com/problems/snapshot-array |
| 11 | 284 | Peeking Iterator | 45.7% | Medium | 0.03110670713225487 | https://leetcode.com/problems/peeking-iterator |
| 12 | 227 | Basic Calculator II | 36.9% | Medium | 0.027685557859864054 | https://leetcode.com/problems/basic-calculator-ii |
| 13 | 498 | Diagonal Traverse | 48.2% | Medium | 0.02756894104498661 | https://leetcode.com/problems/diagonal-traverse |
| 14 | 1438 | Longest Continuous Subarray With Absolute Diff Less Than or Equal to Limit | 42.1% | Medium | 0.026955809988528263 | https://leetcode.com/problems/longest-continuous-subarray-with-absolute-diff-less-than-or-equal-to-limit |
| 15 | 130 | Surrounded Regions | 28.1% | Medium | 0.02672368055211276 | https://leetcode.com/problems/surrounded-regions |
| 16 | 951 | Flip Equivalent Binary Trees | 65.8% | Medium | 0.025269822188076344 | https://leetcode.com/problems/flip-equivalent-binary-trees |
| 17 | 40 | Combination Sum II | 48.2% | Medium | 0.021424290044083395 | https://leetcode.com/problems/combination-sum-ii |
| 18 | 341 | Flatten Nested List Iterator | 52.9% | Medium | 0.019980684690483426 | https://leetcode.com/problems/flatten-nested-list-iterator |
| 19 | 787 | Cheapest Flights Within K Stops | 39.3% | Medium | 0.018824085245635554 | https://leetcode.com/problems/cheapest-flights-within-k-stops |
| 20 | 283 | Move Zeroes | 57.8% | Easy | 0.01789853050377608 | https://leetcode.com/problems/move-zeroes |
| 21 | 240 | Search a 2D Matrix II | 43.2% | Medium | 0.0169815401480941 | https://leetcode.com/problems/search-a-2d-matrix-ii |
| 22 | 658 | Find K Closest Elements | 40.9% | Medium | 0.016611677666896175 | https://leetcode.com/problems/find-k-closest-elements |
| 23 | 51 | N-Queens | 46.6% | Hard | 0.016393809775676407 | https://leetcode.com/problems/n-queens |
| 24 | 297 | Serialize and Deserialize Binary Tree | 47.5% | Hard | 0.01585377577217724 | https://leetcode.com/problems/serialize-and-deserialize-binary-tree |
| 25 | 215 | Kth Largest Element in an Array | 55.4% | Medium | 0.015519225147600912 | https://leetcode.com/problems/kth-largest-element-in-an-array |
| 26 | 153 | Find Minimum in Rotated Sorted Array | 45.1% | Medium | 0.014939586916186732 | https://leetcode.com/problems/find-minimum-in-rotated-sorted-array |
| 27 | 443 | String Compression | 41.3% | Easy | 0.01390843004613198 | https://leetcode.com/problems/string-compression |
| 28 | 703 | Kth Largest Element in a Stream | 49.7% | Easy | 0.013898764390814973 | https://leetcode.com/problems/kth-largest-element-in-a-stream |
| 29 | 138 | Copy List with Random Pointer | 36.4% | Medium | 0.013876263355766411 | https://leetcode.com/problems/copy-list-with-random-pointer |
| 30 | 767 | Reorganize String | 48.7% | Medium | 0.01329806830463147 | https://leetcode.com/problems/reorganize-string |
| 31 | 665 | Non-decreasing Array | 19.5% | Easy | 0.013016779950191773 | https://leetcode.com/problems/non-decreasing-array |
| 32 | 33 | Search in Rotated Sorted Array | 34.5% | Medium | 0.012857779194289386 | https://leetcode.com/problems/search-in-rotated-sorted-array |
| 33 | 129 | Sum Root to Leaf Numbers | 49.1% | Medium | 0.012739025777429757 | https://leetcode.com/problems/sum-root-to-leaf-numbers |
| 34 | 213 | House Robber II | 36.5% | Medium | 0.012654392210497564 | https://leetcode.com/problems/house-robber-ii |
| 35 | 445 | Add Two Numbers II | 54.5% | Medium | 0.01233061245747872 | https://leetcode.com/problems/add-two-numbers-ii |
| 36 | 547 | Friend Circles | 58.6% | Medium | 0.012228828639434596 | https://leetcode.com/problems/friend-circles |
| 37 | 300 | Longest Increasing Subsequence | 42.6% | Medium | 0.011806512586989004 | https://leetcode.com/problems/longest-increasing-subsequence |
| 38 | 200 | Number of Islands | 46.8% | Medium | 0.011509262420590827 | https://leetcode.com/problems/number-of-islands |
| 39 | 785 | Is Graph Bipartite? | 47.5% | Medium | 0.011236073266925854 | https://leetcode.com/problems/is-graph-bipartite |
| 40 | 160 | Intersection of Two Linked Lists | 40.6% | Easy | 0.010994491398666248 | https://leetcode.com/problems/intersection-of-two-linked-lists |
| 41 | 662 | Maximum Width of Binary Tree | 41.0% | Medium | 0.010790501245113902 | https://leetcode.com/problems/maximum-width-of-binary-tree |
| 42 | 17 | Letter Combinations of a Phone Number | 46.8% | Medium | 0.00987716546167603 | https://leetcode.com/problems/letter-combinations-of-a-phone-number |
| 43 | 3 | Longest Substring Without Repeating Characters | 30.4% | Medium | 0.009683242444739549 | https://leetcode.com/problems/longest-substring-without-repeating-characters |
| 44 | 560 | Subarray Sum Equals K | 43.9% | Medium | 0.009603146783199741 | https://leetcode.com/problems/subarray-sum-equals-k |
| 45 | 46 | Permutations | 63.5% | Medium | 0.009461803137288448 | https://leetcode.com/problems/permutations |
| 46 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.009092808657599025 | https://leetcode.com/problems/merge-k-sorted-lists |
| 47 | 5 | Longest Palindromic Substring | 29.5% | Medium | 0.009086325220960808 | https://leetcode.com/problems/longest-palindromic-substring |
| 48 | 977 | Squares of a Sorted Array | 72.1% | Easy | 0.008733679968754604 | https://leetcode.com/problems/squares-of-a-sorted-array |
| 49 | 394 | Decode String | 50.0% | Medium | 0.008166644000272283 | https://leetcode.com/problems/decode-string |
| 50 | 56 | Merge Intervals | 39.3% | Medium | 0.007796972706004796 | https://leetcode.com/problems/merge-intervals |
| 51 | 994 | Rotting Oranges | 49.2% | Medium | 0.007630712341163886 | https://leetcode.com/problems/rotting-oranges |
| 52 | 1 | Two Sum | 45.6% | Easy | 0.0073613942765888805 | https://leetcode.com/problems/two-sum |
| 53 | 41 | First Missing Positive | 32.0% | Hard | 0.0064113058208121855 | https://leetcode.com/problems/first-missing-positive |
| 54 | 83 | Remove Duplicates from Sorted List | 45.4% | Easy | 0.006353261522609498 | https://leetcode.com/problems/remove-duplicates-from-sorted-list |
| 55 | 202 | Happy Number | 50.4% | Easy | 0.006266666286010046 | https://leetcode.com/problems/happy-number |
| 56 | 76 | Minimum Window Substring | 34.6% | Hard | 0.006231520398723243 | https://leetcode.com/problems/minimum-window-substring |
| 57 | 31 | Next Permutation | 32.6% | Medium | 0.005989835219179644 | https://leetcode.com/problems/next-permutation |
| 58 | 39 | Combination Sum | 56.1% | Medium | 0.005715934396440999 | https://leetcode.com/problems/combination-sum |
| 59 | 199 | Binary Tree Right Side View | 54.1% | Medium | 0.0056826406650506926 | https://leetcode.com/problems/binary-tree-right-side-view |
| 60 | 206 | Reverse Linked List | 62.5% | Easy | 0.005257021452801617 | https://leetcode.com/problems/reverse-linked-list |
| 61 | 20 | Valid Parentheses | 39.0% | Easy | 0.005168860577665306 | https://leetcode.com/problems/valid-parentheses |
| 62 | 42 | Trapping Rain Water | 48.9% | Hard | 0.004350670338744988 | https://leetcode.com/problems/trapping-rain-water |
| 63 | 322 | Coin Change | 35.5% | Medium | 0.004029826126500844 | https://leetcode.com/problems/coin-change |
| 64 | 189 | Rotate Array | 34.7% | Easy | 0.004029826126500844 | https://leetcode.com/problems/rotate-array |
| 65 | 238 | Product of Array Except Self | 60.1% | Medium | 0.003930436424724545 | https://leetcode.com/problems/product-of-array-except-self |
| 66 | 139 | Word Break | 40.1% | Medium | 0.003894465052690167 | https://leetcode.com/problems/word-break |
| 67 | 103 | Binary Tree Zigzag Level Order Traversal | 48.3% | Medium | 0.003839922800048048 | https://leetcode.com/problems/binary-tree-zigzag-level-order-traversal |
| 68 | 8 | String to Integer (atoi) | 15.4% | Medium | 0.0037925521897059712 | https://leetcode.com/problems/string-to-integer-atoi |
| 69 | 198 | House Robber | 42.0% | Easy | 0.0037576371128333645 | https://leetcode.com/problems/house-robber |
| 70 | 102 | Binary Tree Level Order Traversal | 54.6% | Medium | 0.003639014205004082 | https://leetcode.com/problems/binary-tree-level-order-traversal |
| 71 | 141 | Linked List Cycle | 41.1% | Easy | 0.0034937584669245472 | https://leetcode.com/problems/linked-list-cycle |
| 72 | 347 | Top K Frequent Elements | 61.2% | Medium | 0.0033396446491217604 | https://leetcode.com/problems/top-k-frequent-elements |
| 73 | 14 | Longest Common Prefix | 35.4% | Easy | 0.003320331762984143 | https://leetcode.com/problems/longest-common-prefix |
| 74 | 66 | Plus One | 43.0% | Easy | 0.00326211347832938 | https://leetcode.com/problems/plus-one |
| 75 | 98 | Validate Binary Search Tree | 27.8% | Medium | 0.002943776044013381 | https://leetcode.com/problems/validate-binary-search-tree |
| 76 | 21 | Merge Two Sorted Lists | 53.5% | Easy | 0.0022551737583973706 | https://leetcode.com/problems/merge-two-sorted-lists |
| 77 | 15 | 3Sum | 26.8% | Medium | 0.0021990113314367685 | https://leetcode.com/problems/3sum |
| 78 | 50 | Pow(x;n) | 30.3% | Medium | 0.0014016892647828818 | https://leetcode.com/problems/powx-n |