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)
```
55 lines
5.9 KiB
CSV
55 lines
5.9 KiB
CSV
ID,Title,Acceptance,Difficulty,Frequency,Leetcode Question Link
|
|
735,Asteroid Collision,41.0%,Medium,3.4954470610602737, https://leetcode.com/problems/asteroid-collision
|
|
238,Product of Array Except Self,60.1%,Medium,2.8845625241577855, https://leetcode.com/problems/product-of-array-except-self
|
|
716,Max Stack,42.6%,Easy,2.664361506099879, https://leetcode.com/problems/max-stack
|
|
158,Read N Characters Given Read4 II - Call multiple times,33.8%,Hard,2.0534769691973906, https://leetcode.com/problems/read-n-characters-given-read4-ii-call-multiple-times
|
|
642,Design Search Autocomplete System,44.7%,Hard,1.7721893730339577, https://leetcode.com/problems/design-search-autocomplete-system
|
|
981,Time Based Key-Value Store,53.1%,Medium,1.4448976756888186, https://leetcode.com/problems/time-based-key-value-store
|
|
365,Water and Jug Problem,30.6%,Medium,1.372259043003507, https://leetcode.com/problems/water-and-jug-problem
|
|
200,Number of Islands,46.8%,Medium,1.3061913612704517, https://leetcode.com/problems/number-of-islands
|
|
42,Trapping Rain Water,48.9%,Hard,1.1347229625176425, https://leetcode.com/problems/trapping-rain-water
|
|
127,Word Ladder,29.6%,Medium,0.5839478885949534, https://leetcode.com/problems/word-ladder
|
|
349,Intersection of Two Arrays,62.5%,Easy,0.5467734703822922, https://leetcode.com/problems/intersection-of-two-arrays
|
|
68,Text Justification,27.7%,Hard,0.4495613440132932, https://leetcode.com/problems/text-justification
|
|
126,Word Ladder II,22.1%,Hard,0.37426780280681504, https://leetcode.com/problems/word-ladder-ii
|
|
426,Convert Binary Search Tree to Sorted Doubly Linked List,59.1%,Medium,0.3308542443169896, https://leetcode.com/problems/convert-binary-search-tree-to-sorted-doubly-linked-list
|
|
91,Decode Ways,24.7%,Medium,0.32434096851350985, https://leetcode.com/problems/decode-ways
|
|
146,LRU Cache,33.2%,Medium,0.2585885798043696, https://leetcode.com/problems/lru-cache
|
|
279,Perfect Squares,47.4%,Medium,0.24693241327822452, https://leetcode.com/problems/perfect-squares
|
|
251,Flatten 2D Vector,45.7%,Medium,0.2425088583672668, https://leetcode.com/problems/flatten-2d-vector
|
|
17,Letter Combinations of a Phone Number,46.8%,Medium,0.22166457131988548, https://leetcode.com/problems/letter-combinations-of-a-phone-number
|
|
304,Range Sum Query 2D - Immutable,38.6%,Medium,0.20226153257780005, https://leetcode.com/problems/range-sum-query-2d-immutable
|
|
155,Min Stack,44.5%,Easy,0.15817175770099312, https://leetcode.com/problems/min-stack
|
|
652,Find Duplicate Subtrees,50.2%,Medium,0.1532629744871177, https://leetcode.com/problems/find-duplicate-subtrees
|
|
76,Minimum Window Substring,34.6%,Hard,0.14520312778609068, https://leetcode.com/problems/minimum-window-substring
|
|
333,Largest BST Subtree,35.8%,Medium,0.13138400282910845, https://leetcode.com/problems/largest-bst-subtree
|
|
109,Convert Sorted List to Binary Search Tree,47.7%,Medium,0.12302181451266285, https://leetcode.com/problems/convert-sorted-list-to-binary-search-tree
|
|
341,Flatten Nested List Iterator,52.9%,Medium,0.11879160861126825, https://leetcode.com/problems/flatten-nested-list-iterator
|
|
10,Regular Expression Matching,26.8%,Hard,0.10921172706929158, https://leetcode.com/problems/regular-expression-matching
|
|
11,Container With Most Water,50.8%,Medium,0.07400372347113877, https://leetcode.com/problems/container-with-most-water
|
|
632,Smallest Range Covering Elements from K Lists,52.4%,Hard,0.07082605256861242, https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists
|
|
23,Merge k Sorted Lists,40.2%,Hard,0.06293239083543646, https://leetcode.com/problems/merge-k-sorted-lists
|
|
22,Generate Parentheses,62.7%,Medium,0.05215612134598845, https://leetcode.com/problems/generate-parentheses
|
|
78,Subsets,62.0%,Medium,0.044263005655043326, https://leetcode.com/problems/subsets
|
|
121,Best Time to Buy and Sell Stock,50.5%,Easy,0.04215422741819192, https://leetcode.com/problems/best-time-to-buy-and-sell-stock
|
|
1094,Car Pooling,56.7%,Medium,0.04016604172533471, https://leetcode.com/problems/car-pooling
|
|
20,Valid Parentheses,39.0%,Easy,0.03618871742239114, https://leetcode.com/problems/valid-parentheses
|
|
79,Word Search,35.6%,Medium,0.03318208821436187, https://leetcode.com/problems/word-search
|
|
694,Number of Distinct Islands,56.0%,Medium,0.03278982282299087, https://leetcode.com/problems/number-of-distinct-islands
|
|
253,Meeting Rooms II,45.7%,Medium,0.03193246767820989, https://leetcode.com/problems/meeting-rooms-ii
|
|
69,Sqrt(x),33.9%,Easy,0.03146892772463772, https://leetcode.com/problems/sqrtx
|
|
48,Rotate Image,56.7%,Medium,0.03142936253029228, https://leetcode.com/problems/rotate-image
|
|
7,Reverse Integer,25.8%,Easy,0.029372034825448746, https://leetcode.com/problems/reverse-integer
|
|
88,Merge Sorted Array,39.4%,Easy,0.02677137871391415, https://leetcode.com/problems/merge-sorted-array
|
|
442,Find All Duplicates in an Array,67.8%,Medium,0.02608087555279249, https://leetcode.com/problems/find-all-duplicates-in-an-array
|
|
162,Find Peak Element,43.3%,Medium,0.02516251642407408, https://leetcode.com/problems/find-peak-element
|
|
1,Two Sum,45.6%,Easy,0.024530411623017775, https://leetcode.com/problems/two-sum
|
|
283,Move Zeroes,57.8%,Easy,0.01789853050377608, https://leetcode.com/problems/move-zeroes
|
|
239,Sliding Window Maximum,43.0%,Hard,0.01768566434627554, https://leetcode.com/problems/sliding-window-maximum
|
|
1060,Missing Element in Sorted Array,54.5%,Medium,0.017429635135283658, https://leetcode.com/problems/missing-element-in-sorted-array
|
|
567,Permutation in String,44.4%,Medium,0.014947961435873182, https://leetcode.com/problems/permutation-in-string
|
|
24,Swap Nodes in Pairs,50.4%,Medium,0.013945066390122038, https://leetcode.com/problems/swap-nodes-in-pairs
|
|
2,Add Two Numbers,33.9%,Medium,0.010507388732168088, https://leetcode.com/problems/add-two-numbers
|
|
21,Merge Two Sorted Lists,53.5%,Easy,0.0022551737583973706, https://leetcode.com/problems/merge-two-sorted-lists
|
|
443,String Compression,41.3%,Easy,0, https://leetcode.com/problems/string-compression
|