Files
LeetCode-Questions-CompanyWise/jpmorgan_2year.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.4 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2202Happy Number50.4%Easy2.788803446881718https://leetcode.com/problems/happy-number
320Valid Parentheses39.0%Easy1.5639916071962492https://leetcode.com/problems/valid-parentheses
4322Coin Change35.5%Medium0.3391797675107801https://leetcode.com/problems/coin-change
51328Break a Palindrome43.3%Medium0.05910139227591337https://leetcode.com/problems/break-a-palindrome
69Palindrome Number48.4%Easy0.03659309116122965https://leetcode.com/problems/palindrome-number
7121Best Time to Buy and Sell Stock50.5%Easy0.033453179586686504https://leetcode.com/problems/best-time-to-buy-and-sell-stock
8273Integer to English Words27.1%Hard0.026980053764546055https://leetcode.com/problems/integer-to-english-words
953Maximum Subarray46.5%Easy0.019336728821707075https://leetcode.com/problems/maximum-subarray
107Reverse Integer25.8%Easy0.016627790608488954https://leetcode.com/problems/reverse-integer
1131Next Permutation32.6%Medium0.013427025530888667https://leetcode.com/problems/next-permutation
12200Number of Islands46.8%Medium0.011509262420590827https://leetcode.com/problems/number-of-islands
13146LRU Cache33.2%Medium0.010321192540274932https://leetcode.com/problems/lru-cache
1417Letter Combinations of a Phone Number46.8%Medium0.00987716546167603https://leetcode.com/problems/letter-combinations-of-a-phone-number
15349Intersection of Two Arrays62.5%Easy0.00725034896230682https://leetcode.com/problems/intersection-of-two-arrays
1639Combination Sum56.1%Medium0.005715934396440999https://leetcode.com/problems/combination-sum
17387First Unique Character in a String53.4%Easy0.00418541994270691https://leetcode.com/problems/first-unique-character-in-a-string
18215Kth Largest Element in an Array55.4%Medium0.003902443976931749https://leetcode.com/problems/kth-largest-element-in-an-array
194Median of Two Sorted Arrays29.6%Hard0.003900160950094767https://leetcode.com/problems/median-of-two-sorted-arrays
201Two Sum45.6%Easy0.003278422738041615https://leetcode.com/problems/two-sum
2133Search in Rotated Sorted Array34.5%Medium0.003229976968332634https://leetcode.com/problems/search-in-rotated-sorted-array
225Longest Palindromic Substring29.5%Medium0.002279333142507479https://leetcode.com/problems/longest-palindromic-substring
2379Word Search35.6%Medium0.0016647248725526849https://leetcode.com/problems/word-search