LeetCode-Questions-CompanyWise/nutanix_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.1 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2991Broken Calculator45.6%Medium0.9286521051883538https://leetcode.com/problems/broken-calculator
31052Grumpy Bookstore Owner55.4%Medium0.6706615869791757https://leetcode.com/problems/grumpy-bookstore-owner
445Jump Game II30.6%Hard0.38527871413740994https://leetcode.com/problems/jump-game-ii
5403Frog Jump39.7%Hard0.0998958412956442https://leetcode.com/problems/frog-jump
6273Integer to English Words27.1%Hard0.04747257415466348https://leetcode.com/problems/integer-to-english-words
7253Meeting Rooms II45.7%Medium0.018087309810579388https://leetcode.com/problems/meeting-rooms-ii
817Letter Combinations of a Phone Number46.8%Medium0.017492519932499718https://leetcode.com/problems/letter-combinations-of-a-phone-number
9703Kth Largest Element in a Stream49.7%Easy0.013898764390814973https://leetcode.com/problems/kth-largest-element-in-a-stream
1055Jump Game34.6%Medium0.011265609194218986https://leetcode.com/problems/jump-game
1140Combination Sum II48.2%Medium0.009578617297069781https://leetcode.com/problems/combination-sum-ii
12128Longest Consecutive Sequence45.1%Hard0.009051883485315484https://leetcode.com/problems/longest-consecutive-sequence
13238Product of Array Except Self60.1%Medium0.008821856860216758https://leetcode.com/problems/product-of-array-except-self
14977Squares of a Sorted Array72.1%Easy0.008733679968754604https://leetcode.com/problems/squares-of-a-sorted-array
1533Search in Rotated Sorted Array34.5%Medium0.007252832180390353https://leetcode.com/problems/search-in-rotated-sorted-array
16146LRU Cache33.2%Medium0.004600353139061353https://leetcode.com/problems/lru-cache
17234Palindrome Linked List39.3%Easy0.004533613114828982https://leetcode.com/problems/palindrome-linked-list
1822Generate Parentheses62.7%Medium0.0043611059090124735https://leetcode.com/problems/generate-parentheses
19283Move Zeroes57.8%Easy0.0028853803470673955https://leetcode.com/problems/move-zeroes
205Longest Palindromic Substring29.5%Medium0.002279333142507479https://leetcode.com/problems/longest-palindromic-substring