Files
LeetCode-Questions-CompanyWise/snapchat_1year.csv
Krishna Kumar Dey fb5f78b55e Chore: Add headers to all the files (#54)
## 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)

```
2023-04-01 11:07:49 +05:30

3.5 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2317Shortest Distance from All Buildings41.4%Hard0.14037470417111314https://leetcode.com/problems/shortest-distance-from-all-buildings
3146LRU Cache33.2%Medium0.10560037836986279https://leetcode.com/problems/lru-cache
4632Smallest Range Covering Elements from K Lists52.4%Hard0.07082605256861242https://leetcode.com/problems/smallest-range-covering-elements-from-k-lists
5772Basic Calculator III41.3%Hard0.06331227941432688https://leetcode.com/problems/basic-calculator-iii
6212Word Search II34.9%Hard0.05999879858378973https://leetcode.com/problems/word-search-ii
7224Basic Calculator36.8%Hard0.046568165477211425https://leetcode.com/problems/basic-calculator
81031Maximum Sum of Two Non-Overlapping Subarrays57.9%Medium0.03711000965123125https://leetcode.com/problems/maximum-sum-of-two-non-overlapping-subarrays
91146Snapshot Array37.0%Medium0.0317991816929387https://leetcode.com/problems/snapshot-array
1068Text Justification27.7%Hard0.0276451606661453https://leetcode.com/problems/text-justification
11310Minimum Height Trees32.3%Medium0.02446605215440636https://leetcode.com/problems/minimum-height-trees
12340Longest Substring with At Most K Distinct Characters44.1%Hard0.016122880486563188https://leetcode.com/problems/longest-substring-with-at-most-k-distinct-characters
1379Word Search35.6%Medium0.014883688014740005https://leetcode.com/problems/word-search
14329Longest Increasing Path in a Matrix43.4%Hard0.013400535537482126https://leetcode.com/problems/longest-increasing-path-in-a-matrix
1591Decode Ways24.7%Medium0.013379120336324091https://leetcode.com/problems/decode-ways
16227Basic Calculator II36.9%Medium0.01239941490503826https://leetcode.com/problems/basic-calculator-ii
17986Interval List Intersections67.3%Medium0.011969023795320735https://leetcode.com/problems/interval-list-intersections
18200Number of Islands46.8%Medium0.011509262420590827https://leetcode.com/problems/number-of-islands
19733Flood Fill55.3%Easy0.011217167530924988https://leetcode.com/problems/flood-fill
20234Palindrome Linked List39.3%Easy0.010171877938733932https://leetcode.com/problems/palindrome-linked-list
2142Trapping Rain Water48.9%Hard0.009762524655659178https://leetcode.com/problems/trapping-rain-water
22139Word Break40.1%Medium0.008741314401573542https://leetcode.com/problems/word-break
23394Decode String50.0%Medium0.008166644000272283https://leetcode.com/problems/decode-string
24253Meeting Rooms II45.7%Medium0.008079219870546493https://leetcode.com/problems/meeting-rooms-ii
2556Merge Intervals39.3%Medium0.007796972706004796https://leetcode.com/problems/merge-intervals
26415Add Strings47.5%Easy0.007587289812159497https://leetcode.com/problems/add-strings
2714Longest Common Prefix35.4%Easy0.00745530292090591https://leetcode.com/problems/longest-common-prefix
28297Serialize and Deserialize Binary Tree47.5%Hard0.007077170374085099https://leetcode.com/problems/serialize-and-deserialize-binary-tree
2954Spiral Matrix34.1%Medium0.0065941551175130245https://leetcode.com/problems/spiral-matrix
30189Rotate Array34.7%Easy0.004029826126500844https://leetcode.com/problems/rotate-array
31347Top K Frequent Elements61.2%Medium0.0033396446491217604https://leetcode.com/problems/top-k-frequent-elements
32210Course Schedule II40.7%Medium0.0019086707135282834https://leetcode.com/problems/course-schedule-ii