mirror of
https://github.com/McSmog/LeetCode-Questions-CompanyWise.git
synced 2026-04-19 16:56:45 +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.6 KiB
6.6 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 1086 | High Five | 79.7% | Easy | 1.3586699801761455 | https://leetcode.com/problems/high-five |
| 3 | 780 | Reaching Points | 29.4% | Hard | 1.054860335368066 | https://leetcode.com/problems/reaching-points |
| 4 | 42 | Trapping Rain Water | 48.9% | Hard | 0.9988138361152376 | https://leetcode.com/problems/trapping-rain-water |
| 5 | 1041 | Robot Bounded In Circle | 49.6% | Medium | 0.695004191307158 | https://leetcode.com/problems/robot-bounded-in-circle |
| 6 | 209 | Minimum Size Subarray Sum | 38.2% | Medium | 0.612452943971577 | https://leetcode.com/problems/minimum-size-subarray-sum |
| 7 | 1163 | Last Substring in Lexicographical Order | 33.9% | Hard | 0.6115111972698513 | https://leetcode.com/problems/last-substring-in-lexicographical-order |
| 8 | 387 | First Unique Character in a String | 53.4% | Easy | 0.32101462511769185 | https://leetcode.com/problems/first-unique-character-in-a-string |
| 9 | 4 | Median of Two Sorted Arrays | 29.6% | Hard | 0.24868407775398862 | https://leetcode.com/problems/median-of-two-sorted-arrays |
| 10 | 524 | Longest Word in Dictionary through Deleting | 48.4% | Medium | 0.24560650857731212 | https://leetcode.com/problems/longest-word-in-dictionary-through-deleting |
| 11 | 166 | Fraction to Recurring Decimal | 21.6% | Medium | 0.22263451592525935 | https://leetcode.com/problems/fraction-to-recurring-decimal |
| 12 | 443 | String Compression | 41.3% | Easy | 0.15834355808729428 | https://leetcode.com/problems/string-compression |
| 13 | 592 | Fraction Addition and Subtraction | 49.0% | Medium | 0.15718558352241233 | https://leetcode.com/problems/fraction-addition-and-subtraction |
| 14 | 532 | K-diff Pairs in an Array | 31.6% | Easy | 0.15718558352241233 | https://leetcode.com/problems/k-diff-pairs-in-an-array |
| 15 | 862 | Shortest Subarray with Sum at Least K | 24.6% | Hard | 0.09793753498670578 | https://leetcode.com/problems/shortest-subarray-with-sum-at-least-k |
| 16 | 64 | Minimum Path Sum | 54.5% | Medium | 0.09380040794039024 | https://leetcode.com/problems/minimum-path-sum |
| 17 | 49 | Group Anagrams | 56.9% | Medium | 0.09101320494254857 | https://leetcode.com/problems/group-anagrams |
| 18 | 688 | Knight Probability in Chessboard | 48.9% | Medium | 0.08392620769993404 | https://leetcode.com/problems/knight-probability-in-chessboard |
| 19 | 939 | Minimum Area Rectangle | 51.8% | Medium | 0.08361414004113359 | https://leetcode.com/problems/minimum-area-rectangle |
| 20 | 547 | Friend Circles | 58.6% | Medium | 0.07408600065076033 | https://leetcode.com/problems/friend-circles |
| 21 | 1051 | Height Checker | 71.1% | Easy | 0.06960783038095686 | https://leetcode.com/problems/height-checker |
| 22 | 289 | Game of Life | 54.5% | Medium | 0.06756473699960104 | https://leetcode.com/problems/game-of-life |
| 23 | 1395 | Count Number of Teams | 82.0% | Medium | 0.056405927913552076 | https://leetcode.com/problems/count-number-of-teams |
| 24 | 647 | Palindromic Substrings | 60.6% | Medium | 0.040968350772541844 | https://leetcode.com/problems/palindromic-substrings |
| 25 | 706 | Design HashMap | 61.3% | Easy | 0.039016652342451774 | https://leetcode.com/problems/design-hashmap |
| 26 | 657 | Robot Return to Origin | 73.5% | Easy | 0.03896596853338373 | https://leetcode.com/problems/robot-return-to-origin |
| 27 | 993 | Cousins in Binary Tree | 52.0% | Easy | 0.03876454345024432 | https://leetcode.com/problems/cousins-in-binary-tree |
| 28 | 942 | DI String Match | 72.6% | Easy | 0.03865215443427916 | https://leetcode.com/problems/di-string-match |
| 29 | 322 | Coin Change | 35.5% | Medium | 0.024924029676386045 | https://leetcode.com/problems/coin-change |
| 30 | 8 | String to Integer (atoi) | 15.4% | Medium | 0.023470848345506903 | https://leetcode.com/problems/string-to-integer-atoi |
| 31 | 326 | Power of Three | 42.1% | Easy | 0.023341308632796296 | https://leetcode.com/problems/power-of-three |
| 32 | 1209 | Remove All Adjacent Duplicates in String II | 56.9% | Medium | 0.02324334737232728 | https://leetcode.com/problems/remove-all-adjacent-duplicates-in-string-ii |
| 33 | 99 | Recover Binary Search Tree | 39.7% | Hard | 0.02310905839365837 | https://leetcode.com/problems/recover-binary-search-tree |
| 34 | 146 | LRU Cache | 33.2% | Medium | 0.01827577993873683 | https://leetcode.com/problems/lru-cache |
| 35 | 200 | Number of Islands | 46.8% | Medium | 0.017925481766054456 | https://leetcode.com/problems/number-of-islands |
| 36 | 560 | Subarray Sum Equals K | 43.9% | Medium | 0.017009020666013328 | https://leetcode.com/problems/subarray-sum-equals-k |
| 37 | 153 | Find Minimum in Rotated Sorted Array | 45.1% | Medium | 0.014939586916186732 | https://leetcode.com/problems/find-minimum-in-rotated-sorted-array |
| 38 | 724 | Find Pivot Index | 44.0% | Easy | 0.013850636933899008 | https://leetcode.com/problems/find-pivot-index |
| 39 | 120 | Triangle | 44.2% | Medium | 0.013236460625830901 | https://leetcode.com/problems/triangle |
| 40 | 121 | Best Time to Buy and Sell Stock | 50.5% | Easy | 0.013201163302846108 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock |
| 41 | 62 | Unique Paths | 54.1% | Medium | 0.010367562048856941 | https://leetcode.com/problems/unique-paths |
| 42 | 238 | Product of Array Except Self | 60.1% | Medium | 0.008821856860216758 | https://leetcode.com/problems/product-of-array-except-self |
| 43 | 876 | Middle of the Linked List | 68.4% | Easy | 0.007624893975696915 | https://leetcode.com/problems/middle-of-the-linked-list |
| 44 | 1 | Two Sum | 45.6% | Easy | 0.0073613942765888805 | https://leetcode.com/problems/two-sum |
| 45 | 19 | Remove Nth Node From End of List | 35.2% | Medium | 0.0069087555063702365 | https://leetcode.com/problems/remove-nth-node-from-end-of-list |
| 46 | 11 | Container With Most Water | 50.8% | Medium | 0.006889188300412141 | https://leetcode.com/problems/container-with-most-water |
| 47 | 76 | Minimum Window Substring | 34.6% | Hard | 0.006231520398723243 | https://leetcode.com/problems/minimum-window-substring |
| 48 | 206 | Reverse Linked List | 62.5% | Easy | 0.005257021452801617 | https://leetcode.com/problems/reverse-linked-list |
| 49 | 237 | Delete Node in a Linked List | 63.8% | Easy | 0.005144705881237697 | https://leetcode.com/problems/delete-node-in-a-linked-list |
| 50 | 53 | Maximum Subarray | 46.5% | Easy | 0.004869349014182134 | https://leetcode.com/problems/maximum-subarray |
| 51 | 155 | Min Stack | 44.5% | Easy | 0.00474891074128171 | https://leetcode.com/problems/min-stack |
| 52 | 17 | Letter Combinations of a Phone Number | 46.8% | Medium | 0.0044018999217624675 | https://leetcode.com/problems/letter-combinations-of-a-phone-number |
| 53 | 242 | Valid Anagram | 56.9% | Easy | 0.004154123743115972 | https://leetcode.com/problems/valid-anagram |
| 54 | 141 | Linked List Cycle | 41.1% | Easy | 0.0034937584669245472 | https://leetcode.com/problems/linked-list-cycle |
| 55 | 56 | Merge Intervals | 39.3% | Medium | 0.0034728286335985107 | https://leetcode.com/problems/merge-intervals |
| 56 | 122 | Best Time to Buy and Sell Stock II | 57.0% | Easy | 0.0033545821461532107 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock-ii |
| 57 | 33 | Search in Rotated Sorted Array | 34.5% | Medium | 0.003229976968332634 | https://leetcode.com/problems/search-in-rotated-sorted-array |
| 58 | 20 | Valid Parentheses | 39.0% | Easy | 0.0023005704055949323 | https://leetcode.com/problems/valid-parentheses |
| 59 | 3 | Longest Substring Without Repeating Characters | 30.4% | Medium | 0.0015556336509412823 | https://leetcode.com/problems/longest-substring-without-repeating-characters |