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

1.9 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2653Two Sum IV - Input is a BST55.5%Easy0.016880386863023497https://leetcode.com/problems/two-sum-iv-input-is-a-bst
31Two Sum45.6%Easy0.013049691753224608https://leetcode.com/problems/two-sum
41290Convert Binary Number in a Linked List to Integer80.4%Easy0.010568130061792257https://leetcode.com/problems/convert-binary-number-in-a-linked-list-to-integer
52Add Two Numbers33.9%Medium0.006737434951993369https://leetcode.com/problems/add-two-numbers
6127Word Ladder29.6%Medium0.005979091056058075https://leetcode.com/problems/word-ladder
720Valid Parentheses39.0%Easy0.005168860577665306https://leetcode.com/problems/valid-parentheses
817Letter Combinations of a Phone Number46.8%Medium0.0044018999217624675https://leetcode.com/problems/letter-combinations-of-a-phone-number
942Trapping Rain Water48.9%Hard0.004350670338744988https://leetcode.com/problems/trapping-rain-water
10387First Unique Character in a String53.4%Easy0.00418541994270691https://leetcode.com/problems/first-unique-character-in-a-string
11238Product of Array Except Self60.1%Medium0.003930436424724545https://leetcode.com/problems/product-of-array-except-self
1249Group Anagrams56.9%Medium0.0038040939835560453https://leetcode.com/problems/group-anagrams
1356Merge Intervals39.3%Medium0.0034728286335985107https://leetcode.com/problems/merge-intervals
14344Reverse String68.5%Easy0.003269579502519813https://leetcode.com/problems/reverse-string
155Longest Palindromic Substring29.5%Medium0.002279333142507479https://leetcode.com/problems/longest-palindromic-substring
16153Sum26.8%Medium0.0021990113314367685https://leetcode.com/problems/3sum
1726Remove Duplicates from Sorted Array45.1%Easy0.0019513153174351963https://leetcode.com/problems/remove-duplicates-from-sorted-array