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.0 KiB
4.0 KiB
| 1 | ID | Title | Acceptance | Difficulty | Frequency | Leetcode Question Link |
|---|---|---|---|---|---|---|
| 2 | 273 | Integer to English Words | 27.1% | Hard | 0.37861967367115135 | https://leetcode.com/problems/integer-to-english-words |
| 3 | 146 | LRU Cache | 33.2% | Medium | 0.3225459261278396 | https://leetcode.com/problems/lru-cache |
| 4 | 387 | First Unique Character in a String | 53.4% | Easy | 0.29387200474932007 | https://leetcode.com/problems/first-unique-character-in-a-string |
| 5 | 236 | Lowest Common Ancestor of a Binary Tree | 45.7% | Medium | 0.27050984255037824 | https://leetcode.com/problems/lowest-common-ancestor-of-a-binary-tree |
| 6 | 353 | Design Snake Game | 34.2% | Medium | 0.2144360950070665 | https://leetcode.com/problems/design-snake-game |
| 7 | 449 | Serialize and Deserialize BST | 52.0% | Medium | 0.17895898716948455 | https://leetcode.com/problems/serialize-and-deserialize-bst |
| 8 | 981 | Time Based Key-Value Store | 53.1% | Medium | 0.17728013452102853 | https://leetcode.com/problems/time-based-key-value-store |
| 9 | 127 | Word Ladder | 29.6% | Medium | 0.16031071649701922 | https://leetcode.com/problems/word-ladder |
| 10 | 739 | Daily Temperatures | 63.3% | Medium | 0.14268538871155678 | https://leetcode.com/problems/daily-temperatures |
| 11 | 43 | Multiply Strings | 33.9% | Medium | 0.13149814559900883 | https://leetcode.com/problems/multiply-strings |
| 12 | 113 | Path Sum II | 46.7% | Medium | 0.10919117261048063 | https://leetcode.com/problems/path-sum-ii |
| 13 | 362 | Design Hit Counter | 63.7% | Medium | 0.09391059944990159 | https://leetcode.com/problems/design-hit-counter |
| 14 | 139 | Word Break | 40.1% | Medium | 0.07342247443539282 | https://leetcode.com/problems/word-break |
| 15 | 437 | Path Sum III | 47.2% | Medium | 0.07021412138431063 | https://leetcode.com/problems/path-sum-iii |
| 16 | 112 | Path Sum | 41.2% | Easy | 0.062250218772217134 | https://leetcode.com/problems/path-sum |
| 17 | 443 | String Compression | 41.3% | Easy | 0.052333720049023605 | https://leetcode.com/problems/string-compression |
| 18 | 20 | Valid Parentheses | 39.0% | Easy | 0.034596174971291214 | https://leetcode.com/problems/valid-parentheses |
| 19 | 4 | Median of Two Sorted Arrays | 29.6% | Hard | 0.032966999734600134 | https://leetcode.com/problems/median-of-two-sorted-arrays |
| 20 | 1 | Two Sum | 45.6% | Easy | 0.03267443218434049 | https://leetcode.com/problems/two-sum |
| 21 | 53 | Maximum Subarray | 46.5% | Easy | 0.02512179687463535 | https://leetcode.com/problems/maximum-subarray |
| 22 | 121 | Best Time to Buy and Sell Stock | 50.5% | Easy | 0.02468763599282147 | https://leetcode.com/problems/best-time-to-buy-and-sell-stock |
| 23 | 23 | Merge k Sorted Lists | 40.2% | Hard | 0.023981964686485415 | https://leetcode.com/problems/merge-k-sorted-lists |
| 24 | 285 | Inorder Successor in BST | 40.4% | Medium | 0.021266085846178402 | https://leetcode.com/problems/inorder-successor-in-bst |
| 25 | 212 | Word Search II | 34.9% | Hard | 0.021038644146708085 | https://leetcode.com/problems/word-search-ii |
| 26 | 33 | Search in Rotated Sorted Array | 34.5% | Medium | 0.019219533793635182 | https://leetcode.com/problems/search-in-rotated-sorted-array |
| 27 | 268 | Missing Number | 51.7% | Easy | 0.01854480591539982 | https://leetcode.com/problems/missing-number |
| 28 | 151 | Reverse Words in a String | 21.9% | Medium | 0.018535861301292162 | https://leetcode.com/problems/reverse-words-in-a-string |
| 29 | 289 | Game of Life | 54.5% | Medium | 0.01662548684613402 | https://leetcode.com/problems/game-of-life |
| 30 | 299 | Bulls and Cows | 42.4% | Easy | 0.015504186535965254 | https://leetcode.com/problems/bulls-and-cows |
| 31 | 79 | Word Search | 35.6% | Medium | 0.014673179500416637 | https://leetcode.com/problems/word-search |
| 32 | 150 | Evaluate Reverse Polish Notation | 36.3% | Medium | 0.01355493475171521 | https://leetcode.com/problems/evaluate-reverse-polish-notation |
| 33 | 3 | Longest Substring Without Repeating Characters | 30.4% | Medium | 0.013288251045064422 | https://leetcode.com/problems/longest-substring-without-repeating-characters |
| 34 | 13 | Roman to Integer | 55.7% | Easy | 0.01303586978808304 | https://leetcode.com/problems/roman-to-integer |
| 35 | 695 | Max Area of Island | 62.7% | Medium | 0.012132390248237822 | https://leetcode.com/problems/max-area-of-island |
| 36 | 140 | Word Break II | 32.6% | Hard | 0.010661081786113668 | https://leetcode.com/problems/word-break-ii |
| 37 | 8 | String to Integer (atoi) | 15.4% | Medium | 0.008133799926770198 | https://leetcode.com/problems/string-to-integer-atoi |
| 38 | 283 | Move Zeroes | 57.8% | Easy | 0.002758622439079723 | https://leetcode.com/problems/move-zeroes |