LeetCode-Questions-CompanyWise/twilio_alltime.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.8 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2974Subarray Sums Divisible by K48.9%Medium1.8764428348188085https://leetcode.com/problems/subarray-sums-divisible-by-k
3146LRU Cache33.2%Medium1.1096937929728194https://leetcode.com/problems/lru-cache
4935Knight Dialer45.2%Medium0.3429447511268304https://leetcode.com/problems/knight-dialer
568Text Justification27.7%Hard0.29518712556880805https://leetcode.com/problems/text-justification
6332Reconstruct Itinerary36.7%Medium0.24722791193435328https://leetcode.com/problems/reconstruct-itinerary
720Valid Parentheses39.0%Easy0.09286263438126167https://leetcode.com/problems/valid-parentheses
8225Implement Stack using Queues45.1%Easy0.03661922580674248https://leetcode.com/problems/implement-stack-using-queues
9560Subarray Sum Equals K43.9%Medium0.026450970794755804https://leetcode.com/problems/subarray-sum-equals-k
10532K-diff Pairs in an Array31.6%Easy0.018735911057469818https://leetcode.com/problems/k-diff-pairs-in-an-array
11139Word Break40.1%Medium0.015487677691351377https://leetcode.com/problems/word-break
12380Insert Delete GetRandom O(1)47.5%Medium0.009820849864094454https://leetcode.com/problems/insert-delete-getrandom-o1
1349Group Anagrams56.9%Medium0.008538951314232168https://leetcode.com/problems/group-anagrams
141Two Sum45.6%Easy0.0051178232035212715https://leetcode.com/problems/two-sum
1517Letter Combinations of a Phone Number46.8%Medium0.0044018999217624675https://leetcode.com/problems/letter-combinations-of-a-phone-number
1614Longest Common Prefix35.4%Easy0.003320331762984143https://leetcode.com/problems/longest-common-prefix
17965Univalued Binary Tree67.7%Easy0https://leetcode.com/problems/univalued-binary-tree
181507Reformat Date60.5%Easy0https://leetcode.com/problems/reformat-date