mirror of
https://github.com/McSmog/LeetCode-Questions-CompanyWise.git
synced 2026-04-19 08:46: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)
```
4.5 KiB
4.5 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 1130 | Minimum Cost Tree From Leaf Values | 66.1% | Medium | 2.445077590079096 | https://leetcode.com/problems/minimum-cost-tree-from-leaf-values |
| 3 | 255 | Verify Preorder Sequence in Binary Search Tree | 45.7% | Medium | 1.9602473122017205 | https://leetcode.com/problems/verify-preorder-sequence-in-binary-search-tree |
| 4 | 1163 | Last Substring in Lexicographical Order | 33.9% | Hard | 1.4754170343243447 | https://leetcode.com/problems/last-substring-in-lexicographical-order |
| 5 | 25 | Reverse Nodes in k-Group | 42.1% | Hard | 1.2885884475283234 | https://leetcode.com/problems/reverse-nodes-in-k-group |
| 6 | 526 | Beautiful Arrangement | 57.8% | Medium | 0.995199193294679 | https://leetcode.com/problems/beautiful-arrangement |
| 7 | 500 | Keyboard Row | 64.7% | Easy | 0.9589833161754686 | https://leetcode.com/problems/keyboard-row |
| 8 | 317 | Shortest Distance from All Buildings | 41.4% | Hard | 0.7748252115742125 | https://leetcode.com/problems/shortest-distance-from-all-buildings |
| 9 | 206 | Reverse Linked List | 62.5% | Easy | 0.6128482175082197 | https://leetcode.com/problems/reverse-linked-list |
| 10 | 697 | Degree of an Array | 53.8% | Easy | 0.5986563371390229 | https://leetcode.com/problems/degree-of-an-array |
| 11 | 319 | Bulb Switcher | 45.4% | Medium | 0.3156951086794549 | https://leetcode.com/problems/bulb-switcher |
| 12 | 741 | Cherry Pickup | 33.9% | Hard | 0.309961111072881 | https://leetcode.com/problems/cherry-pickup |
| 13 | 63 | Unique Paths II | 34.6% | Medium | 0.2738591247074177 | https://leetcode.com/problems/unique-paths-ii |
| 14 | 20 | Valid Parentheses | 39.0% | Easy | 0.226282513205836 | https://leetcode.com/problems/valid-parentheses |
| 15 | 199 | Binary Tree Right Side View | 54.1% | Medium | 0.18661020557359304 | https://leetcode.com/problems/binary-tree-right-side-view |
| 16 | 259 | 3Sum Smaller | 47.6% | Medium | 0.18485641239714268 | https://leetcode.com/problems/3sum-smaller |
| 17 | 232 | Implement Queue using Stacks | 49.6% | Easy | 0.12970837911872232 | https://leetcode.com/problems/implement-queue-using-stacks |
| 18 | 338 | Counting Bits | 69.5% | Medium | 0.12580669538551648 | https://leetcode.com/problems/counting-bits |
| 19 | 200 | Number of Islands | 46.8% | Medium | 0.06985103785996453 | https://leetcode.com/problems/number-of-islands |
| 20 | 225 | Implement Stack using Queues | 45.1% | Easy | 0.06420174665671244 | https://leetcode.com/problems/implement-stack-using-queues |
| 21 | 115 | Distinct Subsequences | 38.3% | Hard | 0.061494781607806234 | https://leetcode.com/problems/distinct-subsequences |
| 22 | 62 | Unique Paths | 54.1% | Medium | 0.055187969852649885 | https://leetcode.com/problems/unique-paths |
| 23 | 133 | Clone Graph | 34.8% | Medium | 0.049801168649527466 | https://leetcode.com/problems/clone-graph |
| 24 | 1319 | Number of Operations to Make Network Connected | 53.1% | Medium | 0.04587960575069364 | https://leetcode.com/problems/number-of-operations-to-make-network-connected |
| 25 | 49 | Group Anagrams | 56.9% | Medium | 0.045631752563977224 | https://leetcode.com/problems/group-anagrams |
| 26 | 314 | Binary Tree Vertical Order Traversal | 45.3% | Medium | 0.04007660092703385 | https://leetcode.com/problems/binary-tree-vertical-order-traversal |
| 27 | 1 | Two Sum | 45.6% | Easy | 0.024530411623017775 | https://leetcode.com/problems/two-sum |
| 28 | 836 | Rectangle Overlap | 48.6% | Easy | 0.024228925974379843 | https://leetcode.com/problems/rectangle-overlap |
| 29 | 647 | Palindromic Substrings | 60.6% | Medium | 0.023250853650202817 | https://leetcode.com/problems/palindromic-substrings |
| 30 | 2 | Add Two Numbers | 33.9% | Medium | 0.020491663368639005 | https://leetcode.com/problems/add-two-numbers |
| 31 | 98 | Validate Binary Search Tree | 27.8% | Medium | 0.01825801101705589 | https://leetcode.com/problems/validate-binary-search-tree |
| 32 | 509 | Fibonacci Number | 67.2% | Easy | 0.01593518138579736 | https://leetcode.com/problems/fibonacci-number |
| 33 | 404 | Sum of Left Leaves | 50.9% | Easy | 0.013981353230340547 | https://leetcode.com/problems/sum-of-left-leaves |
| 34 | 15 | 3Sum | 26.8% | Medium | 0.013665148419080968 | https://leetcode.com/problems/3sum |
| 35 | 695 | Max Area of Island | 62.7% | Medium | 0.012686500631003836 | https://leetcode.com/problems/max-area-of-island |
| 36 | 43 | Multiply Strings | 33.9% | Medium | 0.009145011150062768 | https://leetcode.com/problems/multiply-strings |
| 37 | 106 | Construct Binary Tree from Inorder and Postorder Traversal | 47.2% | Medium | 0.005258250021550252 | https://leetcode.com/problems/construct-binary-tree-from-inorder-and-postorder-traversal |
| 38 | 5 | Longest Palindromic Substring | 29.5% | Medium | 0.005121212968082452 | https://leetcode.com/problems/longest-palindromic-substring |
| 39 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.004051459000748015 | https://leetcode.com/problems/merge-k-sorted-lists |
| 40 | 102 | Binary Tree Level Order Traversal | 54.6% | Medium | 0.003639014205004082 | https://leetcode.com/problems/binary-tree-level-order-traversal |
| 41 | 566 | Reshape the Matrix | 60.5% | Easy | 0 | https://leetcode.com/problems/reshape-the-matrix |