LeetCode-Questions-CompanyWise/salesforce_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

2.9 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
21283Find the Smallest Divisor Given a Threshold47.6%Medium0.0665963051641667https://leetcode.com/problems/find-the-smallest-divisor-given-a-threshold
3146LRU Cache33.2%Medium0.054946555458745445https://leetcode.com/problems/lru-cache
4895Maximum Frequency Stack60.6%Hard0.04329680575332419https://leetcode.com/problems/maximum-frequency-stack
5706Design HashMap61.3%Easy0.039016652342451774https://leetcode.com/problems/design-hashmap
617Letter Combinations of a Phone Number46.8%Medium0.03893646375009422https://leetcode.com/problems/letter-combinations-of-a-phone-number
7460LFU Cache34.2%Hard0.030962225603966897https://leetcode.com/problems/lfu-cache
8724Find Pivot Index44.0%Easy0.03089844155123413https://leetcode.com/problems/find-pivot-index
956Merge Intervals39.3%Medium0.030829638084076787https://leetcode.com/problems/merge-intervals
10348Design Tic-Tac-Toe54.3%Medium0.024214258120594613https://leetcode.com/problems/design-tic-tac-toe
11557Reverse Words in a String III69.8%Easy0.013731764001315941https://leetcode.com/problems/reverse-words-in-a-string-iii
12547Friend Circles58.6%Medium0.012228828639434596https://leetcode.com/problems/friend-circles
13211Add and Search Word - Data structure design38.1%Medium0.010438508143923443https://leetcode.com/problems/add-and-search-word-data-structure-design
14212Word Search II34.9%Hard0.009845021678804893https://leetcode.com/problems/word-search-ii
15295Find Median from Data Stream44.3%Hard0.00899893586856953https://leetcode.com/problems/find-median-from-data-stream
16412Fizz Buzz62.3%Easy0.007165921026143679https://leetcode.com/problems/fizz-buzz
1798Validate Binary Search Tree27.8%Medium0.006611351489350257https://leetcode.com/problems/validate-binary-search-tree
1841First Missing Positive32.0%Hard0.0064113058208121855https://leetcode.com/problems/first-missing-positive
1976Minimum Window Substring34.6%Hard0.006231520398723243https://leetcode.com/problems/minimum-window-substring
2020Valid Parentheses39.0%Easy0.005168860577665306https://leetcode.com/problems/valid-parentheses
2148Rotate Image56.7%Medium0.0050955524266001265https://leetcode.com/problems/rotate-image
2242Trapping Rain Water48.9%Hard0.004350670338744988https://leetcode.com/problems/trapping-rain-water
23200Number of Islands46.8%Medium0.0028897578265903614https://leetcode.com/problems/number-of-islands
2453Maximum Subarray46.5%Easy0.002167082872150794https://leetcode.com/problems/maximum-subarray
251Two Sum45.6%Easy0.00184543512358731https://leetcode.com/problems/two-sum
262Add Two Numbers33.9%Medium0.0016886191111440908https://leetcode.com/problems/add-two-numbers
273Longest Substring Without Repeating Characters30.4%Medium0.0015556336509412823https://leetcode.com/problems/longest-substring-without-repeating-characters