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

2.4 KiB

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
2740Delete and Earn48.6%Medium2.0469337965260492https://leetcode.com/problems/delete-and-earn
3366Find Leaves of Binary Tree70.6%Medium1.492934381312693https://leetcode.com/problems/find-leaves-of-binary-tree
4547Friend Circles58.6%Medium0.9389349660993366https://leetcode.com/problems/friend-circles
51010Pairs of Songs With Total Durations Divisible by 6047.4%Easy0.8080712743639388https://leetcode.com/problems/pairs-of-songs-with-total-durations-divisible-by-60
641First Missing Positive32.0%Hard0.5197501329149874https://leetcode.com/problems/first-missing-positive
728Implement strStr()34.5%Easy0.49430861720878383https://leetcode.com/problems/implement-strstr
8133Clone Graph34.8%Medium0.4466221331933528https://leetcode.com/problems/clone-graph
975Sort Colors47.3%Medium0.4245095320511369https://leetcode.com/problems/sort-colors
10285Inorder Successor in BST40.4%Medium0.36133895646771014https://leetcode.com/problems/inorder-successor-in-bst
1110Regular Expression Matching26.8%Hard0.15934409022264243https://leetcode.com/problems/regular-expression-matching
12214Shortest Palindrome29.8%Hard0.07220456924739427https://leetcode.com/problems/shortest-palindrome
13347Top K Frequent Elements61.2%Medium0.05152828440155634https://leetcode.com/problems/top-k-frequent-elements
14139Word Break40.1%Medium0.03329941406904932https://leetcode.com/problems/word-break
15269Alien Dictionary33.3%Hard0.027110094009475887https://leetcode.com/problems/alien-dictionary
16215Kth Largest Element in an Array55.4%Medium0.00838696557248326https://leetcode.com/problems/kth-largest-element-in-an-array
17772Basic Calculator III41.3%Hard0https://leetcode.com/problems/basic-calculator-iii
18442Find All Duplicates in an Array67.8%Medium0https://leetcode.com/problems/find-all-duplicates-in-an-array
19380Insert Delete GetRandom O(1)47.5%Medium0https://leetcode.com/problems/insert-delete-getrandom-o1
20424Longest Repeating Character Replacement47.0%Medium0https://leetcode.com/problems/longest-repeating-character-replacement
21600Non-negative Integers without Consecutive Ones34.1%Hard0https://leetcode.com/problems/non-negative-integers-without-consecutive-ones
22692Top K Frequent Words51.8%Medium0https://leetcode.com/problems/top-k-frequent-words