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

1.7 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2974Subarray Sums Divisible by K48.9%Medium0.5083214430545138https://leetcode.com/problems/subarray-sums-divisible-by-k
3146LRU Cache33.2%Medium0.37918622364432397https://leetcode.com/problems/lru-cache
4935Knight Dialer45.2%Medium0.2500510042341341https://leetcode.com/problems/knight-dialer
568Text Justification27.7%Hard0.16143214434637243https://leetcode.com/problems/text-justification
6332Reconstruct Itinerary36.7%Medium0.15671959735502852https://leetcode.com/problems/reconstruct-itinerary
7225Implement Stack using Queues45.1%Easy0.03661922580674248https://leetcode.com/problems/implement-stack-using-queues
8560Subarray Sum Equals K43.9%Medium0.026450970794755804https://leetcode.com/problems/subarray-sum-equals-k
9532K-diff Pairs in an Array31.6%Easy0.018735911057469818https://leetcode.com/problems/k-diff-pairs-in-an-array
10139Word Break40.1%Medium0.015487677691351377https://leetcode.com/problems/word-break
11380Insert Delete GetRandom O(1)47.5%Medium0.009820849864094454https://leetcode.com/problems/insert-delete-getrandom-o1
1249Group Anagrams56.9%Medium0.008538951314232168https://leetcode.com/problems/group-anagrams
1320Valid Parentheses39.0%Easy0.005168860577665306https://leetcode.com/problems/valid-parentheses
1417Letter Combinations of a Phone Number46.8%Medium0.0044018999217624675https://leetcode.com/problems/letter-combinations-of-a-phone-number
1514Longest Common Prefix35.4%Easy0.003320331762984143https://leetcode.com/problems/longest-common-prefix
161Two Sum45.6%Easy0.003278422738041615https://leetcode.com/problems/two-sum