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

1IDTitleAcceptanceDifficultyFrequencyLeetcode Question Link
21Two Sum45.6%Easy0.7025051399779716https://leetcode.com/problems/two-sum
3146LRU Cache33.2%Medium0.521413265967313https://leetcode.com/problems/lru-cache
472Edit Distance44.8%Hard0.4324285917613152https://leetcode.com/problems/edit-distance
52Add Two Numbers33.9%Medium0.4221159733636152https://leetcode.com/problems/add-two-numbers
633Search in Rotated Sorted Array34.5%Medium0.31895461826361493https://leetcode.com/problems/search-in-rotated-sorted-array
7871Minimum Number of Refueling Stops31.4%Hard0.2887275508533339https://leetcode.com/problems/minimum-number-of-refueling-stops
83Longest Substring Without Repeating Characters30.4%Medium0.2884992176890934https://leetcode.com/problems/longest-substring-without-repeating-characters
970Climbing Stairs47.8%Easy0.25415654925180287https://leetcode.com/problems/climbing-stairs
10215Kth Largest Element in an Array55.4%Medium0.0730646752411442https://leetcode.com/problems/kth-largest-element-in-an-array
1188Merge Sorted Array39.4%Easy0.0451990505469574https://leetcode.com/problems/merge-sorted-array
12240Search a 2D Matrix II43.2%Medium0.044650273737738826https://leetcode.com/problems/search-a-2d-matrix-ii
13113Path Sum II46.7%Medium0.03698133452871584https://leetcode.com/problems/path-sum-ii
14410Split Array Largest Sum44.5%Hard0.02436174074003527https://leetcode.com/problems/split-array-largest-sum
1591Decode Ways24.7%Medium0.0227930095285566https://leetcode.com/problems/decode-ways
16153Sum26.8%Medium0.01857638557293541https://leetcode.com/problems/3sum
17124Binary Tree Maximum Path Sum34.3%Hard0.005272883295230408https://leetcode.com/problems/binary-tree-maximum-path-sum
18543Diameter of Binary Tree48.4%Easy0.005047966297304777https://leetcode.com/problems/diameter-of-binary-tree
19588Design In-Memory File System45.9%Hard0https://leetcode.com/problems/design-in-memory-file-system
20397Integer Replacement32.9%Medium0https://leetcode.com/problems/integer-replacement
21395Longest Substring with At Least K Repeating Characters41.4%Medium0https://leetcode.com/problems/longest-substring-with-at-least-k-repeating-characters
22413Arithmetic Slices57.9%Medium0https://leetcode.com/problems/arithmetic-slices
23446Arithmetic Slices II - Subsequence32.7%Hard0https://leetcode.com/problems/arithmetic-slices-ii-subsequence
24488Zuma Game39.9%Hard0https://leetcode.com/problems/zuma-game
25576Out of Boundary Paths35.1%Medium0https://leetcode.com/problems/out-of-boundary-paths
26873Length of Longest Fibonacci Subsequence48.0%Medium0https://leetcode.com/problems/length-of-longest-fibonacci-subsequence