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)
```
5.1 KiB
5.1 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 146 | LRU Cache | 33.2% | Medium | 0.46080211052317804 | https://leetcode.com/problems/lru-cache |
| 3 | 228 | Summary Ranges | 39.5% | Medium | 0.44217848445366176 | https://leetcode.com/problems/summary-ranges |
| 4 | 206 | Reverse Linked List | 62.5% | Easy | 0.44193222040156394 | https://leetcode.com/problems/reverse-linked-list |
| 5 | 125 | Valid Palindrome | 36.7% | Easy | 0.3787282969631441 | https://leetcode.com/problems/valid-palindrome |
| 6 | 22 | Generate Parentheses | 62.7% | Medium | 0.37758248966083463 | https://leetcode.com/problems/generate-parentheses |
| 7 | 1 | Two Sum | 45.6% | Easy | 0.36056657949055176 | https://leetcode.com/problems/two-sum |
| 8 | 283 | Move Zeroes | 57.8% | Easy | 0.3588135394901179 | https://leetcode.com/problems/move-zeroes |
| 9 | 20 | Valid Parentheses | 39.0% | Easy | 0.3161359429418766 | https://leetcode.com/problems/valid-parentheses |
| 10 | 49 | Group Anagrams | 56.9% | Medium | 0.310518994932053 | https://leetcode.com/problems/group-anagrams |
| 11 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.24731507149363313 | https://leetcode.com/problems/merge-k-sorted-lists |
| 12 | 281 | Zigzag Iterator | 58.4% | Medium | 0.22884157242884745 | https://leetcode.com/problems/zigzag-iterator |
| 13 | 443 | String Compression | 41.3% | Easy | 0.19466945271128616 | https://leetcode.com/problems/string-compression |
| 14 | 560 | Subarray Sum Equals K | 43.9% | Medium | 0.1592148659754748 | https://leetcode.com/problems/subarray-sum-equals-k |
| 15 | 56 | Merge Intervals | 39.3% | Medium | 0.1506602748874898 | https://leetcode.com/problems/merge-intervals |
| 16 | 1004 | Max Consecutive Ones III | 59.1% | Medium | 0.14885037047435706 | https://leetcode.com/problems/max-consecutive-ones-iii |
| 17 | 98 | Validate Binary Search Tree | 27.8% | Medium | 0.14682390140626445 | https://leetcode.com/problems/validate-binary-search-tree |
| 18 | 380 | Insert Delete GetRandom O(1) | 47.5% | Medium | 0.13990475142949543 | https://leetcode.com/problems/insert-delete-getrandom-o1 |
| 19 | 232 | Implement Queue using Stacks | 49.6% | Easy | 0.12455784498557357 | https://leetcode.com/problems/implement-queue-using-stacks |
| 20 | 567 | Permutation in String | 44.4% | Medium | 0.12099331128663167 | https://leetcode.com/problems/permutation-in-string |
| 21 | 487 | Max Consecutive Ones II | 48.5% | Medium | 0.10973238837921641 | https://leetcode.com/problems/max-consecutive-ones-ii |
| 22 | 21 | Merge Two Sorted Lists | 53.5% | Easy | 0.10062341537355711 | https://leetcode.com/problems/merge-two-sorted-lists |
| 23 | 59 | Spiral Matrix II | 53.9% | Medium | 0.09113771199852426 | https://leetcode.com/problems/spiral-matrix-ii |
| 24 | 3 | Longest Substring Without Repeating Characters | 30.4% | Medium | 0.080294208103556 | https://leetcode.com/problems/longest-substring-without-repeating-characters |
| 25 | 42 | Trapping Rain Water | 48.9% | Hard | 0.08028083126080282 | https://leetcode.com/problems/trapping-rain-water |
| 26 | 2 | Add Two Numbers | 33.9% | Medium | 0.07642959098535268 | https://leetcode.com/problems/add-two-numbers |
| 27 | 88 | Merge Sorted Array | 39.4% | Easy | 0.0697535511282702 | https://leetcode.com/problems/merge-sorted-array |
| 28 | 101 | Symmetric Tree | 46.8% | Easy | 0.06415501202452933 | https://leetcode.com/problems/symmetric-tree |
| 29 | 332 | Reconstruct Itinerary | 36.7% | Medium | 0.05142521180743711 | https://leetcode.com/problems/reconstruct-itinerary |
| 30 | 933 | Number of Recent Calls | 71.9% | Easy | 0.04470017891790688 | https://leetcode.com/problems/number-of-recent-calls |
| 31 | 4 | Median of Two Sorted Arrays | 29.6% | Hard | 0.032966999734600134 | https://leetcode.com/problems/median-of-two-sorted-arrays |
| 32 | 974 | Subarray Sums Divisible by K | 48.9% | Medium | 0.03213127818279325 | https://leetcode.com/problems/subarray-sums-divisible-by-k |
| 33 | 204 | Count Primes | 31.5% | Easy | 0.026775361248112174 | https://leetcode.com/problems/count-primes |
| 34 | 5 | Longest Palindromic Substring | 29.5% | Medium | 0.02634844326401841 | https://leetcode.com/problems/longest-palindromic-substring |
| 35 | 15 | 3Sum | 26.8% | Medium | 0.025200613617298306 | https://leetcode.com/problems/3sum |
| 36 | 449 | Serialize and Deserialize BST | 52.0% | Medium | 0.021540951371383166 | https://leetcode.com/problems/serialize-and-deserialize-bst |
| 37 | 48 | Rotate Image | 56.7% | Medium | 0.019354662474288496 | https://leetcode.com/problems/rotate-image |
| 38 | 33 | Search in Rotated Sorted Array | 34.5% | Medium | 0.019219533793635182 | https://leetcode.com/problems/search-in-rotated-sorted-array |
| 39 | 19 | Remove Nth Node From End of List | 35.2% | Medium | 0.018335680533090114 | https://leetcode.com/problems/remove-nth-node-from-end-of-list |
| 40 | 71 | Simplify Path | 32.6% | Medium | 0.015486178630494266 | https://leetcode.com/problems/simplify-path |
| 41 | 150 | Evaluate Reverse Polish Notation | 36.3% | Medium | 0.01355493475171521 | https://leetcode.com/problems/evaluate-reverse-polish-notation |
| 42 | 350 | Intersection of Two Arrays II | 51.4% | Easy | 0.011188580169130736 | https://leetcode.com/problems/intersection-of-two-arrays-ii |
| 43 | 34 | Find First and Last Position of Element in Sorted Array | 36.2% | Medium | 0.00915477861600125 | https://leetcode.com/problems/find-first-and-last-position-of-element-in-sorted-array |
| 44 | 279 | Perfect Squares | 47.4% | Medium | 0.008781615160384712 | https://leetcode.com/problems/perfect-squares |
| 45 | 28 | Implement strStr() | 34.5% | Easy | 0.008476223285653011 | https://leetcode.com/problems/implement-strstr |
| 46 | 16 | 3Sum Closest | 46.0% | Medium | 0.00714416326666986 | https://leetcode.com/problems/3sum-closest |
| 47 | 1493 | Longest Subarray of 1's After Deleting One Element | 59.7% | Medium | 0 | https://leetcode.com/problems/longest-subarray-of-1s-after-deleting-one-element |