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)
```
5.8 KiB
5.8 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 635 | Design Log Storage System | 58.6% | Medium | 2.2981349041046517 | https://leetcode.com/problems/design-log-storage-system |
| 3 | 256 | Paint House | 52.1% | Easy | 1.5313678227960323 | https://leetcode.com/problems/paint-house |
| 4 | 780 | Reaching Points | 29.4% | Hard | 1.3793349295510802 | https://leetcode.com/problems/reaching-points |
| 5 | 57 | Insert Interval | 33.5% | Hard | 0.6125678482424609 | https://leetcode.com/problems/insert-interval |
| 6 | 920 | Number of Music Playlists | 46.5% | Hard | 0.2876820724517809 | https://leetcode.com/problems/number-of-music-playlists |
| 7 | 1326 | Minimum Number of Taps to Open to Water a Garden | 43.6% | Hard | 0.2786048543006643 | https://leetcode.com/problems/minimum-number-of-taps-to-open-to-water-a-garden |
| 8 | 945 | Minimum Increment to Make Array Unique | 46.3% | Medium | 0.27427904232444056 | https://leetcode.com/problems/minimum-increment-to-make-array-unique |
| 9 | 547 | Friend Circles | 58.6% | Medium | 0.22246660738239243 | https://leetcode.com/problems/friend-circles |
| 10 | 341 | Flatten Nested List Iterator | 52.9% | Medium | 0.2209211036876481 | https://leetcode.com/problems/flatten-nested-list-iterator |
| 11 | 532 | K-diff Pairs in an Array | 31.6% | Easy | 0.15718558352241233 | https://leetcode.com/problems/k-diff-pairs-in-an-array |
| 12 | 20 | Valid Parentheses | 39.0% | Easy | 0.13750374228546985 | https://leetcode.com/problems/valid-parentheses |
| 13 | 706 | Design HashMap | 61.3% | Easy | 0.10482987091202353 | https://leetcode.com/problems/design-hashmap |
| 14 | 200 | Number of Islands | 46.8% | Medium | 0.09910455319823885 | https://leetcode.com/problems/number-of-islands |
| 15 | 307 | Range Sum Query - Mutable | 34.6% | Medium | 0.08612096757681667 | https://leetcode.com/problems/range-sum-query-mutable |
| 16 | 161 | One Edit Distance | 32.3% | Medium | 0.07982960165248484 | https://leetcode.com/problems/one-edit-distance |
| 17 | 271 | Encode and Decode Strings | 31.5% | Medium | 0.07197349962508924 | https://leetcode.com/problems/encode-and-decode-strings |
| 18 | 647 | Palindromic Substrings | 60.6% | Medium | 0.06329624434241725 | https://leetcode.com/problems/palindromic-substrings |
| 19 | 68 | Text Justification | 27.7% | Hard | 0.06116036187169583 | https://leetcode.com/problems/text-justification |
| 20 | 528 | Random Pick with Weight | 43.9% | Medium | 0.05805039128849884 | https://leetcode.com/problems/random-pick-with-weight |
| 21 | 295 | Find Median from Data Stream | 44.3% | Hard | 0.05495888428075748 | https://leetcode.com/problems/find-median-from-data-stream |
| 22 | 56 | Merge Intervals | 39.3% | Medium | 0.054167920212564245 | https://leetcode.com/problems/merge-intervals |
| 23 | 679 | 24 Game | 46.4% | Hard | 0.05341723749698583 | https://leetcode.com/problems/24-game |
| 24 | 767 | Reorganize String | 48.7% | Medium | 0.05216306328458592 | https://leetcode.com/problems/reorganize-string |
| 25 | 981 | Time Based Key-Value Store | 53.1% | Medium | 0.049406315387071284 | https://leetcode.com/problems/time-based-key-value-store |
| 26 | 1041 | Robot Bounded In Circle | 49.6% | Medium | 0.0483770263821056 | https://leetcode.com/problems/robot-bounded-in-circle |
| 27 | 239 | Sliding Window Maximum | 43.0% | Hard | 0.0483746857022364 | https://leetcode.com/problems/sliding-window-maximum |
| 28 | 490 | The Maze | 51.4% | Medium | 0.04287902305923364 | https://leetcode.com/problems/the-maze |
| 29 | 716 | Max Stack | 42.6% | Easy | 0.042695919196489414 | https://leetcode.com/problems/max-stack |
| 30 | 346 | Moving Average from Data Stream | 70.9% | Easy | 0.03932354620391436 | https://leetcode.com/problems/moving-average-from-data-stream |
| 31 | 380 | Insert Delete GetRandom O(1) | 47.5% | Medium | 0.038717635350707984 | https://leetcode.com/problems/insert-delete-getrandom-o1 |
| 32 | 133 | Clone Graph | 34.8% | Medium | 0.03215711163453134 | https://leetcode.com/problems/clone-graph |
| 33 | 814 | Binary Tree Pruning | 74.5% | Medium | 0.03113091859517317 | https://leetcode.com/problems/binary-tree-pruning |
| 34 | 496 | Next Greater Element I | 63.8% | Easy | 0.029462032730316202 | https://leetcode.com/problems/next-greater-element-i |
| 35 | 482 | License Key Formatting | 43.1% | Easy | 0.024799783060416587 | https://leetcode.com/problems/license-key-formatting |
| 36 | 540 | Single Element in a Sorted Array | 57.9% | Medium | 0.0192128868599912 | https://leetcode.com/problems/single-element-in-a-sorted-array |
| 37 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.016108271385328228 | https://leetcode.com/problems/merge-k-sorted-lists |
| 38 | 76 | Minimum Window Substring | 34.6% | Hard | 0.013966707481708198 | https://leetcode.com/problems/minimum-window-substring |
| 39 | 269 | Alien Dictionary | 33.3% | Hard | 0.012730916694039954 | https://leetcode.com/problems/alien-dictionary |
| 40 | 146 | LRU Cache | 33.2% | Medium | 0.010321192540274932 | https://leetcode.com/problems/lru-cache |
| 41 | 208 | Implement Trie (Prefix Tree) | 49.4% | Medium | 0.009105457856626612 | https://leetcode.com/problems/implement-trie-prefix-tree |
| 42 | 84 | Largest Rectangle in Histogram | 35.2% | Hard | 0.00833685528906183 | https://leetcode.com/problems/largest-rectangle-in-histogram |
| 43 | 101 | Symmetric Tree | 46.8% | Easy | 0.007646596306528098 | https://leetcode.com/problems/symmetric-tree |
| 44 | 36 | Valid Sudoku | 48.7% | Medium | 0.007258242715805398 | https://leetcode.com/problems/valid-sudoku |
| 45 | 10 | Regular Expression Matching | 26.8% | Hard | 0.0071865203293987245 | https://leetcode.com/problems/regular-expression-matching |
| 46 | 91 | Decode Ways | 24.7% | Medium | 0.005968385368349129 | https://leetcode.com/problems/decode-ways |
| 47 | 105 | Construct Binary Tree from Preorder and Inorder Traversal | 48.8% | Medium | 0.005628268691614718 | https://leetcode.com/problems/construct-binary-tree-from-preorder-and-inorder-traversal |
| 48 | 124 | Binary Tree Maximum Path Sum | 34.3% | Hard | 0.005531752454833179 | https://leetcode.com/problems/binary-tree-maximum-path-sum |
| 49 | 169 | Majority Element | 58.7% | Easy | 0.004706444738837472 | https://leetcode.com/problems/majority-element |
| 50 | 139 | Word Break | 40.1% | Medium | 0.003894465052690167 | https://leetcode.com/problems/word-break |
| 51 | 106 | Construct Binary Tree from Inorder and Postorder Traversal | 47.2% | Medium | 0.00234041415121758 | https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal |
| 52 | 210 | Course Schedule II | 40.7% | Medium | 0.0019086707135282834 | https://leetcode.com/problems/course-schedule-ii |
| 53 | 1 | Two Sum | 45.6% | Easy | 0.0008206138651873125 | https://leetcode.com/problems/two-sum |